Back

Trading ETH/BTC

Dear Members,

 

I wanna trade on the pair "ETHBTC". How should be the begin setting in the code?

Trading on "ETHUSD" is no problem. So i thought just changing the _ticker to "ETHBTC" and thats it. But is isn't that simple i guess?

Thanks in advance.

David

namespace QuantConnect.Algorithm.CSharp
{
public class VentralTransdimensionalChamber : QCAlgorithm
{
/*
Trading bot that trades with the highest and lowest exchange rate of the last 24 hours.
Buying determined bacause the factor and the current price.
*/

// VARIABELEN DECLAREREN
private string _ticker = "ETHUSD"; //virtueel paar - tracks the current USD value of 1 ether.
private int _startingCash = 2000;
private decimal _weight = .08m; ///Percentage van portfolio dat je wilt investeren // % of portfolio for every trade.

private decimal _targetPercent = .01m; //1% winst dan verkopen // Sell when 1% profit
private decimal _stopPercent = .10m; //verkopen bij de 10% verlies / Sell when loss is 10%

int _maxPosition = 900; // Max USD invested
int _minPosition = 750; // min USD needed to invest.

public decimal _usd; //Amount of USD in our Cashbook.

Maximum _maxExchange;
Minimum _minExchange;



//PROGRAMMA VARIABELEN
public decimal _price;
public decimal _holding; //Het aantal Ether we in onze portfolio hebben zitten.
public string _baseSymbol; //vertegenwoordigt de basesymbool dat we houden ETH



public decimal _targetPrice;
public decimal _stopPrice;





//INITIALIZE BLOCK
public override void Initialize()
{
SetStartDate(2019, 1, 1);
SetEndDate(2020, 1, 1);
SetCash(_startingCash);


var _crypto = AddCrypto(_ticker, Resolution.Minute);
_baseSymbol = _crypto.BaseCurrencySymbol;

int _minutesOfTrading = 1140;
_maxExchange = MAX(_ticker, _minutesOfTrading, Resolution.Minute);
_minExchange = MIN(_ticker, _minutesOfTrading, Resolution.Minute);

SetWarmUp(_minutesOfTrading, Resolution.Minute);

SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash);
}


}

 

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.


Hi Vronghel,

I suggest using Bitfinex (docs) for the data and brokerage for more crypto pairs support. We also need to SetCash to BTC so we can carry out the conversion. I've shown the necessary changes in the attached backtest.

Also, please see this thread for reference.

Best,
Shile Wen

1

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.


Hi Shile,

Thanks for the answer!!

I'll check it out.

 

Greetings, David

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