public void Logon() { var btxName = MainWindow.Config.BitmexScalper.AccountMode; var setting = SettingRequest.Get(_apiClient, btxName); _btxLiq = new BtxLiquidation(setting.TradeFee); _bitmex = new BitmexExchange(setting); _bitmex.Log = new RestServiceEventLogger(_apiClient, DataType.ServiceName.Desktop); _btxBotClient.Log = _bitmex.Log; createIndicatorRequest = () => new IndicatorRequest(_apiClient); createTradeRequest = () => new TradeRequest(_apiClient); createPosRequest = () => new PositionRequest(_apiClient); createLogRequest = () => new LogRequest(_apiClient); createSettingRequest = () => new SettingRequest(_apiClient); try { _bitmex.Logon(); _btxBotClient.Logon(); } catch (Exception ex) { _bitmex.Log.WriteError(ex); throw ex; } }
public void Start() { var config = (BotcoinConfigSection)ConfigurationManager.GetSection("botcoin"); var btxSetting = SettingRequest.Get(_apiClient, config.BitmexBot.AccountMode); _bitmex = new BitmexExchange(btxSetting); _bitmex.Log = Log; _bitmex.ExecutionChanged += OnExecutionChanged; _bitmex.MarginChanged += OnMarginChanged; _bitmex.OrderChanged += OnOrderChanged; _bitmex.WalletChanged += OnWalletChanged; _bitmex.AuthPassed += OnAuthPassed; _bitmex.Logon(); _btxUser = _bitmex.Exchange.Client.GetAccount(); _bitmex.SubscriptionAuth(null); _instrumentSettingsTimer.Start(); _vwapGainsTimer.Start(); _wsServer.Start(); OnInstrumentSettingsTimerElapsed(null, null); OnVwapGainsTimerElapsed(null, null); }