public Strategy(Exchange exchange, Symbol symbol, TradeBin tradeBin) { Exchange = exchange; Symbol = symbol; TradeBin = tradeBin; Timeout = Const.DIRECTIONAL_STRATEGY_TIMEOUT; LeveragePosted = false; }
public override string GetTradeBin(TradeBin tradeBin, string symbol) { return(GetTradeBin(new Dictionary <string, object> { ["symbol"] = symbol, ["interval"] = tradeBin.ToShortLabel(), })); }
public override string GetTradeBin(TradeBin tradeBin, string symbol, DateTime start) { return(GetTradeBin(new Dictionary <string, object> { ["symbol"] = symbol, ["interval"] = tradeBin.ToShortLabel(), ["startTime"] = Utils.SinceEpochMs(start) })); }
private string GetTradeBinsAfterLatest(TradeBin tradeBin, string symbol) { var table = $"{Name}_{tradeBin.ToLabel()}"; var query = $"select top 1 [timestamp] from [{table}] where [symbol] = '{symbol}' order by [timestamp] desc"; var result = Database.Select(query).Rows; var start = (DateTime)result[0]["timestamp"] + Const.TIME_UNIT; return(Rest.GetTradeBin(tradeBin, symbol, start)); }
public override string GetTradeBin(TradeBin tradeBin, string symbol) { return(GetTradeBin(new Dictionary <string, object> { ["binSize"] = tradeBin.ToLabel().Split('n')[1], ["partial"] = false, ["symbol"] = symbol, ["count"] = 500 })); }
public override string GetTradeBin(TradeBin tradeBin, string symbol, DateTime start) { return(GetTradeBin(new Dictionary <string, object> { ["binSize"] = tradeBin.ToLabel().Split('n')[1], ["partial"] = false, ["symbol"] = symbol, ["count"] = 500, ["startTime"] = start.ToString(Const.DATETIME_FORMAT) })); }
public ChannelStrategy(Exchange exchange, Symbol symbol = Symbol.XBTUSD, TradeBin tradeBin = TradeBin.FiveMinute) : base(exchange, symbol, tradeBin) { // Measurer = new PriceChangeMeasurer { Prices = Prices }; Exchange.Prices[Symbol][TradeBin].Updated += (s, e) => Measurer.Measure(); // Band = new MovingDeviation(Const.BB_PERIOD, Prices); Exchange.Prices[Symbol][TradeBin].Updated += (s, e) => Band.Update(); // Timeout = Const.CHANNEL_STRATEGY_TIMEOUT; }
public DirectionalStrategy(Exchange exchange, Symbol symbol = Symbol.XBTUSD, TradeBin tradeBin = TradeBin.FiveMinute, int fastEmaLength = Const.DIRECTIONAL_FAST_EMA_LENGTH, int slowEmaLength = Const.DIRECTIONAL_SLOW_EMA_LENGTH, int stochLength = Const.DIRECTIONAL_STOCH_LENGTH) : base(exchange, symbol, tradeBin) { // var prices = Exchange.Prices[Symbol][TradeBin]; Macd = new MovingMacd(fastEmaLength, slowEmaLength, prices[Price.Close]); prices.Updated += (s, e) => Macd.Update(); // var volatilities = Exchange.IndexPrices[Index.BVOL24H]; Stoch = new MovingStochastic(stochLength, volatilities[Price.Close]); volatilities.Updated += (s, e) => Stoch.Update(); // Measurer = new IndexStochasticMeasurer { Stoch = Stoch, StochTreshold = StochTreshold }; volatilities.Updated += (s, e) => Measurer.Measure(); // Timeout = Const.DIRECTIONAL_STRATEGY_TIMEOUT; }
public TradeBinEventArgs(TradeBin tradeBin, bool emptyPartial) { TradeBin = tradeBin; EmptyPartial = emptyPartial; }
public virtual string GetTradeBin(TradeBin tradeBin, Symbol symbol) { return(GetTradeBin(tradeBin, symbol.ToString())); }
public abstract string GetTradeBin(TradeBin tradeBin, string symbol);
public override string GetTradeBin(TradeBin tradeBin, string symbol, int start, int count = 500) { throw new NotImplementedException(); }
public virtual string GetTradeBin(TradeBin tradeBin, Index index, int start, int count = 500) { return(GetTradeBin(tradeBin, index.ToString(), start, count)); }
public virtual string GetTradeBin(TradeBin tradeBin, Index index, DateTime start, DateTime end) { return(GetTradeBin(tradeBin, index.ToString(), start, end)); }
public virtual string GetTradeBin(TradeBin tradeBin, Index index) { return(GetTradeBin(tradeBin, index.ToString())); }
public virtual string GetTradeBin(TradeBin tradeBin, Symbol symbol, DateTime start, DateTime end) { return(GetTradeBin(tradeBin, symbol.ToString(), start, end)); }
public virtual string GetTradeBin(TradeBin tradeBin, Symbol symbol, int start, int count = 500) { return(GetTradeBin(tradeBin, symbol.ToString(), start, count)); }
public abstract string GetTradeBin(TradeBin tradeBin, string symbol, int start, int count = 500);
public abstract string GetTradeBin(TradeBin tradeBin, string symbol, DateTime start, DateTime end);