Title: calculating balance · Issue #8 · pythonlessons/FinRock · GitHub
Open Graph Title: calculating balance · Issue #8 · pythonlessons/FinRock
X Title: calculating balance · Issue #8 · pythonlessons/FinRock
Description: I don't understand your math. my vision for calculating the balance is this: if action == 2: # buy buy_order_size = order_size next_state.allocation_percentage = last_state.allocation_percentage + (1 - last_state.allocation_percentage) *...
Open Graph Description: I don't understand your math. my vision for calculating the balance is this: if action == 2: # buy buy_order_size = order_size next_state.allocation_percentage = last_state.allocation_percentage + ...
X Description: I don't understand your math. my vision for calculating the balance is this: if action == 2: # buy buy_order_size = order_size next_state.allocation_percentage = last_state.allocation_percentag...
Opengraph URL: https://github.com/pythonlessons/FinRock/issues/8
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"calculating balance","articleBody":"I don't understand your math.\r\nmy vision for calculating the balance is this:\r\n\r\n```\r\nif action == 2: # buy\r\n buy_order_size = order_size\r\n next_state.allocation_percentage = last_state.allocation_percentage + (1 - last_state.allocation_percentage) * buy_order_size\r\n asset = last_state.balance * buy_order_size / last_state.close\r\n next_state.assets = last_state.assets + asset\r\n balance = last_state.balance * buy_order_size\r\n next_state.balance = last_state.balance - balance - (balance * self.fee_ratio)\r\n\r\nelif action == 1: # sell\r\n sell_order_size = order_size\r\n next_state.allocation_percentage = last_state.allocation_percentage - last_state.allocation_percentage * sell_order_size\r\n balance = last_state.assets * sell_order_size * last_state.close\r\n next_state.balance = last_state.balance + balance - (balance * self.fee_ratio)\r\n next_state.assets = last_state.assets - last_state.assets * sell_order_size\r\n```\r\nmaybe this is valid only for BTCUSDT on binance\r\n\r\nafter all, the exchange receives a percentage of all transactions, and in your code only a percentage of transactions is taken away, and not the purchase/sale cost\r\nit is logical to assume that the transaction will be profitable if the sell_price / buy_price - 1 > fee_ratio","author":{"url":"https://github.com/daliel","@type":"Person","name":"daliel"},"datePublished":"2024-03-18T10:26:21Z","url":"https://github.com/pythonlessons/FinRock/issues/8"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:48ebe01a-b675-9b63-701f-b15e5b089ffb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9D56:1ECC06:2391:2D42:6B042AC7 |
| html-safe-nonce | 37c2f9b2fede991433111429f11503bc89b02988dd4e4d6f7d6605e975eac2a7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RDU2OjFFQ0MwNjoyMzkxOjJENDI6NkIwNDJBQzciLCJ2aXNpdG9yX2lkIjoiMTgyOTI1NjE0NDAxMTY2ODE2NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ae2f49f741b5169395253992f82464be7a7652e1a45707736042259d475ed3f3 |
| hovercard-subject-tag | issue:2191810569 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/pythonlessons/FinRock/8/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9d5a29eca02a9800b0a1a8905bce47dc3450be6a03fe34d3a9fc91e1961d9575/pythonlessons/FinRock/issues/8 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9d5a29eca02a9800b0a1a8905bce47dc3450be6a03fe34d3a9fc91e1961d9575/pythonlessons/FinRock/issues/8 |
| og:image:alt | I don't understand your math. my vision for calculating the balance is this: if action == 2: # buy buy_order_size = order_size next_state.allocation_percentage = last_state.allocation_percentage + ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | daliel |
| hostname | github.com |
| expected-hostname | github.com |
| None | b7a1d2b9101496921b08579fbee988d014345aef2f5bd660d1f8c7332d81560e |
| turbo-cache-control | no-preview |
| go-import | github.com/pythonlessons/FinRock git https://github.com/pythonlessons/FinRock.git |
| octolytics-dimension-user_id | 43852392 |
| octolytics-dimension-user_login | pythonlessons |
| octolytics-dimension-repository_id | 708694811 |
| octolytics-dimension-repository_nwo | pythonlessons/FinRock |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 708694811 |
| octolytics-dimension-repository_network_root_nwo | pythonlessons/FinRock |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c3dd496c3da6ea6b77e69c09279d2b81604654f1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width