HI Does anyone know why my algo keeps getting Inufficient Buying Power to Complete Order ? As my title says it buys like 50 ETH but my setholdings is only for like %10 of my portfolio to be allocated, which would be about $1500 USD… For every coin, the conversion is different.
WHen you trade setholdings with Forex, each currency pair is correctly calculated to be at whatever allocation but this doesn't seem to be the case with crypto coins. Some coins are 10 cents others like BTC are 50,000 a “share”. Is this a known bug and i'm late to the party as usual or am i doing something wrong?
Can someone help look at my def onorderevent at the bottom of the backtest code to help me create a logic that:
when orderStatus.Invalid, it sends a new duplicate order (because you can't resend market orders on coinbase),
new order with a10% less quantity,
it will repeat this reduction of quantity until OrderStatus.Filled for that symbol.
THanks!
Varad Kabade
Hi Apollos Hill,
The issue with invalid orders is related to using SetHoldings to place orders. This method works well with all security types but not with multiple cryptocurrencies (it works well with just one). This is because crypto-currency securities represent a virtual position. For more details, please check out the following community thread:
"BTCUSD" - What are Virtual Positions? #3178
We suggest you take a look at the BasicTemplateCryptoAlgorithm since it's an excellent example of how orders should be created in this case.
Best,
Varad Kabade
Apollos Hill
HI VArad,
Thanks for shedding light on the current issue . I figured i was behind on the existing issues again. I am looking at this template and its great for planning orders on specific coins but i need a model for placing orders on a list of varied coins. Do you have any suggestions? I started implementing the marketorder function using the quantity code provided in this template Its still trying to buy 250 ETH which is way more than i can afford.
Apollos Hill
I just realized that for some of these cross pairs like ETHBTC. i'm not using USD to purchase them so having usdTotal as my quantity basis is invalid. i need to use the base currency, so if buying ETHBTC, i need to use the total BTC quantity i have. Any suggestings on coding this for 12 pairs without writing a thousand lines of code ? :-P i'm not a developer but i'm learning…
edit: I don't see any cross pairs in this template. Searching for an exampe in the github now.
Varad Kabade
Hi Apollos Hill,
To buy ETHBTC, we would need to get the amount of BTC from the portfolio, and the Same goes for trading with other pairs. Refer to the following code snippet for reference.
Best,
Varad Kabade
Apollos Hill
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!