Order with fixed amount.

Posted By: hanw

Order with fixed amount. - 08/01/21 11:29

I have a strategy that send fixed amount buy orders. It buys $50 worth of stock each time, irrespective of the price of the stock. It is possible to simulate this in Zorro? It seems the lot size in enterLong() has to be a int type. How do I express the idea such as: Zorro, please enter a long position that is worth $50?
Posted By: Petra

Re: Order with fixed amount. - 08/01/21 13:31

That would be probably easy when you know an API broker that sells you a non integer number of shares.
Posted By: hanw

Re: Order with fixed amount. - 08/02/21 06:15

I'm working with Binance API which support trading fractional lot of crypto. My question is how to get the following function call working in Zorro.

entryLong(0.001); // enter a long position with 0.001 share of BTCUSD.
Posted By: Petra

Re: Order with fixed amount. - 08/02/21 06:45

There is no "share of BTCUSD" because its no stock. Its a digital coin. Read in the manual about lot amounts and asset lists.

https://manual.zorro-project.com/lots.htm
Posted By: AndrewAMD

Re: Order with fixed amount. - 08/02/21 10:54

Also, mind the LotAmount value in your asset list.

You can set the Amount variable instead of the Lots value to get the intended effect.

For example, suppose you want to buy 0.1 BTC/USD. If LotAmount is 0.001 and you set the Amount variable to 0.1 in your script, then it will set Lots to the correct value of 100. 100 x 0.001 BTC/USD = 0.1 BTC/USD.
© 2024 lite-C Forums