-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
How to place exact dollar value to buy/sell #226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If one unit of asset (e.g. a contract) costs $3.91 and you want to spend $10, you just have to figure out how many (whole) units fit in to sum at most $10. Basic arithmetic. Does this help? Please also review the existing FAQ. This sort of question had been answered a couple times already. |
Hi I checked some your reply on another post, it says: current_price = self.data.Close[-1] so if YFIUSD last close price = 36521 so then on your backtesting.py i put: current_price = self.data.Close[-1] this is my actual code: I get 0. No trades execute. |
This comment has been minimized.
This comment has been minimized.
order_size = 100 // current_price from #137 indicates the number of units fitting into $100 allowance. In your case:
In that case, also make sure your input dataframe is denominated in unit prices (e.g. $3.65), not contract prices ($36,521). Alternatively, if you just want to sell one mini lot, pass: self.sell(size=10_000) |
Hi, I have rediscovered the same issue and tried to find the root of that. my request |
var size
Order size (negative for short orders).
If size is a value between 0 and 1, it is interpreted as a fraction of current available liquidity (cash plus Position.pl minus used margin). A value greater than or equal to 1 indicates an absolute number of units.
I dont understand how to know how much dollars the size is if its greater than 1.
I want to be able to do for example, 1 contract of XYZ/USD = $3.91 USD
I want to be able to work with numbers like that and place orders and do position sizing with this type of contracts.
Thanks
The text was updated successfully, but these errors were encountered: