Hi all,
I am starting to test my strategy with Binance paper trading and after deploying my algo I am facing some issues related with initial cash / holdings mainly. I have read a lot of threads about this topic but honestly I didn't find a solution for the issue. Two main questions:
1/ I have set up my strategy to run with USDT as account currency (self.SetAccountCurrency("USDT")) and I am trying to override without success the initial cash with the following sentences in the Initialize method:
self.SetAccountCurrency("USDT")
#Option 1
self.SetCash("USDT", 1000) # Set Strategy Cash
self.SetCash("BTC", 0) # Set Initial BTC holding
#Option 2
self.Portfolio.SetCash("USDT", 1000, 0) # Set Strategy Cash
self.Portfolio.SetCash("BTC", 0, 0) # Set Initial BTC holding
I know first option only work with backtesting but second one doesn't work either. After deploying the algo I always found the following cash values in my "Algorithm Holdings":
As you can see, not only USDT (account currency) has been initialized with a initial position but other coins (BTC, XRP, LTC,…) have also an initial position. Is there any chance to override these initial values to 0? I don't want to have any initial position except my initial “cash” in base currency (USDT).
The rational behind is that my algo include some controls to identify whether I have position in some coins and this predefined situation break my algo definitely.
2/ once I have modified the code to test it in paper trading, I am facing some errors with backtesting. When I perform a market order I always specify the ticket (BTCUSD before and BTCUSDT now) and the BTC quantity to buy or sell. Now, after these changes, I get an error that says: “OrderID: 1 Warning - Code: NotSupported - The minimum order size (in quote currency) for BTCUSDT is 10. Order quantity was 0.00014.”
It seems the system is now understanding that the quantity I am specifiying is the quantity of USDT to spend instead of the quantity of BTC to buy/sell. From my humble opinion, It`s quite strange this change behavior after modifying only the account currency. Do you have any explanation for this?
Thank you in advance for you help and support
Best,
Jesus
Louis Szeto
Hi Jesus Ruiz Bustos
In live trading environment, the portfolio balance is fetched from the brokerage and cannot be set like in the backtest. That is the initial balance given by Binance Spot Test Network, so you may need to modify that in your Binance account setting.
Binance has set a minimum order size for each pair in their quote currency. To comply with the brokerage and provide the most realistic environment, we set the minimum order size in the same way.
Best
Louis
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Jesus Ruiz Bustos
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!