Back

Help setting up simple buy and sell for crypto (C#) and a couple other questions

Hi all,

I'm pretty new here. I haven't had any issues with setting up algos so far, but a couple things about crypto are throwing me off.

I looked at this example of a buy for BTCUSD:
https://www.quantconnect.com/forum/discussion/2747/crypto-trading-on-quantconnect

It uses SetHoldings, but I believe I read somewhere in the documentation that SetHoldings() would crash a live algo on GDAX.
Is that true or is the above algo OK?


On the same note,
I read that Liquidate() has some issues with crypto because of virtual positions. Is that true/what's the preferred method?

 

With the aforementioned things in mind, can someone help me set up a simple algo in C# with:
A market order that buys BTCUSD using 50% of available/free cash (Not portfolio value--just cash that isn't in assets already--not sure what the variable for this is)

And a week after purchasing:
An order to sell 50% of bought BTCUSD (note: not necessarily the same amount that was bought)..

An attached backtest with the aforementioned code would be awesome, and give me a lot of insight into how QC functions, particularly in regards with crypto and C#!

 

Thanks!
Steven H.

Update Backtest








If I"m not mistaken, if you specify AccountType Cash you shouldn't have any issues with SetHoldings.

There's a thread on virtual positions here, though it's confusing to me, it may help you:

https://www.quantconnect.com/forum/discussion/3178/quotbtcusdquot---what-are-virtual-positions/

I'm not familiar with crypto but perhaps someone else in the community can help set up your backtest!

0

Update Backtest





0

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.


Loading...

This discussion is closed