예제 #1
0
 public async Task <HaasonlineClientResponse <Orderbook> > GetOrderbook(EnumPriceSource priceSource, string primairyCoin, string secondairyCoin, string contractName)
 {
     return(await ExecuteAsync <Orderbook>("/GetOrderbook", new Dictionary <string, string>
     {
         { "priceSourceName", priceSource.ToString() },
         { "primaryCoin", primairyCoin },
         { "secondaryCoin", secondairyCoin },
         { "contractName", contractName }
     }, authorize : false));
 }
예제 #2
0
 public async Task <HaasonlineClientResponse <TradeContainer> > GetLastTrades(EnumPriceSource priceSource, string primairyCoin, string secondairyCoin, string contractName)
 {
     return(await ExecuteAsync <TradeContainer>("/GetLastTrades", new Dictionary <string, string>
     {
         { "priceSourceName", priceSource.ToString() },
         { "primaryCoin", primairyCoin },
         { "secondaryCoin", secondairyCoin },
         { "contractName", contractName },
     }, authorize : false));
 }
예제 #3
0
 public async Task <HaasonlineClientResponse <List <PriceTick> > > GetHistory(EnumPriceSource priceSource, string primairyCoin, string secondairyCoin, string contractName, int interval, int depth)
 {
     return(await ExecuteAsync <List <PriceTick> >("/GetHistory", new Dictionary <string, string>
     {
         { "priceSourceName", priceSource.ToString() },
         { "primaryCoin", primairyCoin },
         { "secondaryCoin", secondairyCoin },
         { "contractName", contractName },
         { "interval", interval.ToString() },
         { "depth", depth.ToString() },
     }, authorize : false));
 }
        public static void AddHistoryEntry(string accountGuid, EnumPriceSource priceSource, string primaryCurrency, string secondaryCurrency, decimal activationRoi, decimal observedHigh, decimal normalBackTestValue)
        {
            BackTestData backTestData = new BackTestData();

            backTestData.AccountGUID         = accountGuid;
            backTestData.Exchange            = priceSource;
            backTestData.PrimaryCurrency     = primaryCurrency;
            backTestData.SecondayCurrency    = secondaryCurrency;
            backTestData.ActivationROI       = activationRoi;
            backTestData.ObservedHigh        = observedHigh;
            backTestData.StaticBackTestValue = normalBackTestValue;

            BackTestHistoryManager.backTestHistory.history.Add(backTestData);
        }
        public static PriceTick GetOneMinutePriceDataForMarket(EnumPriceSource priceSource, string primaryCoin, string secondaryCoin)
        {
            if (HaasActionManager.CheckHaasConnection())
            {
                HaasonlineClient haasonlineClient = new HaasonlineClient(ConfigManager.mainConfig.IPAddress, ConfigManager.mainConfig.Port, ConfigManager.mainConfig.Secret);

                var priceTickTask = Task.Run(async() => await haasonlineClient.MarketDataApi.GetMinutePriceTicker(priceSource, primaryCoin, secondaryCoin, ""));

                priceTickTask.Wait();

                return(priceTickTask.Result.Result);
            }

            return(null);
        }
        public static void UpdateHistoryEntry(string accountGuid, EnumPriceSource priceSource, string primaryCurrency, string secondaryCurrency, decimal activationRoi, decimal observedHigh, decimal normalBackTestValue)
        {
            foreach (var backTestEntry in BackTestHistoryManager.backTestHistory.history)
            {
                if (backTestEntry.AccountGUID.Equals(accountGuid) &&
                    backTestEntry.PrimaryCurrency == primaryCurrency &&
                    backTestEntry.SecondayCurrency == secondaryCurrency)
                {
                    BackTestHistoryManager.RemoveHistoryEntry(backTestEntry);
                    BackTestHistoryManager.AddHistoryEntry(accountGuid, priceSource, primaryCurrency, secondaryCurrency, activationRoi, observedHigh, normalBackTestValue);
                    return;
                }
            }

            BackTestHistoryManager.AddHistoryEntry(accountGuid, priceSource, primaryCurrency, secondaryCurrency, activationRoi, observedHigh, normalBackTestValue);
        }
 public async Task <HaasonlineClientResponse <TradeBot> > SetupSafety(string botGuid, string elementGuid, EnumPriceSource priceSource, string primairyCoin, string secondairyCoin, string contractName, EnumFundsPosition buySignal, EnumFundsPosition sellSignal)
 {
     return(await ExecuteAsync <TradeBot>("/SetupTradeBotSafety", new Dictionary <string, string>
     {
         { "botGuid", botGuid },
         { "elementGuid", elementGuid },
         { "priceSourceName", priceSource.ToString() },
         { "primaryCoin", primairyCoin },
         { "secondaryCoin", secondairyCoin },
         { "contractName", contractName },
         { "mappedBuySignal", buySignal.ToString() },
         { "mappedSellSignal", sellSignal.ToString() },
     }));
 }
 public async Task <HaasonlineClientResponse <TradeBot> > SetupIndicator(string botGuid, string elementGuid, EnumPriceSource priceSource, string primairyCoin, string secondairyCoin, string contractName, int interval, EnumPriceChartType chartType, int delay)
 {
     return(await ExecuteAsync <TradeBot>("/SetupTradeBotIndicator", new Dictionary <string, string>
     {
         { "botGuid", botGuid },
         { "elementGuid", elementGuid },
         { "priceSourceName", priceSource.ToString() },
         { "primaryCoin", primairyCoin },
         { "secondaryCoin", secondairyCoin },
         { "contractName", contractName },
         { "interval", interval.ToString(CultureInfo.InvariantCulture) },
         { "delay", delay.ToString() },
         { "priceChartType", chartType.ToString() },
     }));
 }
예제 #9
0
 public async Task <HaasonlineClientResponse <List <Market> > > GetPriceMarkets(EnumPriceSource priceSource)
 {
     return(await ExecuteAsync <List <Market> >("/GetPriceMarkets", new Dictionary <string, string>
     {
         { "priceSourceName", priceSource.ToString() }
     }, authorize : false));
 }