public static TradeTransactionCommand CreateTradeTransactionCommand(TRADE_OPERATION_CODE cmd, TRADE_TRANSACTION_TYPE type, double?price, double?sl, double?tp, string symbol, double?volume, long?order, string customComment, long?expiration, bool prettyPrint = false) { JSONObject args = new JSONObject(); args.Add("tradeTransInfo", (new TradeTransInfoRecord(cmd, type, price, sl, tp, symbol, volume, order, customComment, expiration)).toJSONObject()); return(new TradeTransactionCommand(args, prettyPrint)); }
public TradeTransInfoRecord(TRADE_OPERATION_CODE cmd, TRADE_TRANSACTION_TYPE type, double?price, double?sl, double?tp, string symbol, double?volume, long?ie_deviation, long?order, string comment, long?expiration) { this.cmd = cmd; this.type = type; this.price = price; this.sl = sl; this.tp = tp; this.symbol = symbol; this.volume = volume; this.order = order; this.expiration = expiration; customComment = comment; }
private void TransakcjaStart(string Nazwa, double volume, TRADE_OPERATION_CODE toc) { try { SyncAPIConnector connector = new SyncAPIConnector(serverData); Credentials credentials = new Credentials(userId, password, "", "pixelNet"); LoginResponse loginResponse = APICommandFactory.ExecuteLoginCommand(connector, credentials, true); SymbolResponse symbolResponse = APICommandFactory.ExecuteSymbolCommand(connector, Nazwa); double price = symbolResponse.Symbol.Ask.GetValueOrDefault(); double sl = 0.0; double tp = 0.0; string symbol = symbolResponse.Symbol.Symbol; long order = 0; long expiration = 0; TradeTransInfoRecord ttOpenInfoRecord = new TradeTransInfoRecord( toc, TRADE_TRANSACTION_TYPE.ORDER_OPEN, price, sl, tp, symbol, volume, order, "", expiration); TradeTransactionResponse tradeTransactionResponse = APICommandFactory.ExecuteTradeTransactionCommand(connector, ttOpenInfoRecord); LogoutResponse logoutResponse = APICommandFactory.ExecuteLogoutCommand(connector); } catch (Exception e) { MessageBox.Show(e.Message); } }
public static TradeTransactionResponse ExecuteTradeTransactionCommand(SyncAPIConnector connector, TRADE_OPERATION_CODE cmd, TRADE_TRANSACTION_TYPE type, double?price, double?sl, double?tp, string symbol, double?volume, long?ie_deviation, long?order, string comment, long?expiration, bool prettyPrint = false) { return(new TradeTransactionResponse(connector.ExecuteCommand(CreateTradeTransactionCommand(cmd, type, price, sl, tp, symbol, volume, order, "", expiration, prettyPrint)).ToString())); }
public static ProfitCalculationResponse ExecuteProfitCalculationCommand(SyncAPIConnector connector, string symbol, double?volume, TRADE_OPERATION_CODE cmd, double?openPrice, double?closePrice, bool prettyPrint = false) { return(new ProfitCalculationResponse(connector.ExecuteCommand(CreateProfitCalculationCommand(symbol, volume, cmd, openPrice, closePrice, prettyPrint)).ToString())); }
public static TradeTransactionCommand CreateTradeTransactionCommand(TRADE_OPERATION_CODE cmd, TRADE_TRANSACTION_TYPE type, double?price, double?sl, double?tp, string symbol, double?volume, long?ie_deviation, long?order, string comment, long?expiration, bool prettyPrint = false) { return(CreateTradeTransactionCommand(cmd, type, price, sl, tp, symbol, volume, order, "", expiration)); }
public static ProfitCalculationCommand CreateProfitCalculationCommand(string symbol, double?volume, TRADE_OPERATION_CODE cmd, double?openPrice, double?closePrice, bool prettyPrint = false) { JSONObject args = new JSONObject(); args.Add("symbol", symbol); args.Add("volume", volume); args.Add("cmd", cmd.Code); args.Add("openPrice", openPrice); args.Add("closePrice", closePrice); return(new ProfitCalculationCommand(args, prettyPrint)); }