public ProtoMessage CreateUnsubscribeForTradingEventsRequest(long accountId, string clientMsgId = null) { var _msg = ProtoOAUnsubscribeFromTradingEventsReq.CreateBuilder(); _msg.SetAccountId(accountId); return(CreateMessage((uint)_msg.PayloadType, _msg.Build().ToByteString(), clientMsgId)); }
public ProtoMessage CreateUnsubscribeForTradingEventsRequest(long accountId, string clientMsgId = null) { var _msg = new ProtoOAUnsubscribeFromTradingEventsReq(); _msg.accountId = accountId; return(CreateMessage((uint)_msg.payloadType, Utils.Serialize <ProtoOAUnsubscribeFromTradingEventsReq>(_msg), clientMsgId)); }
public ProtoOAUnsubscribeFromTradingEventsReq GetUnsubscribeForTradingEventsRequest(byte[] msg = null) { return(ProtoOAUnsubscribeFromTradingEventsReq.CreateBuilder().MergeFrom(GetPayload(msg)).Build()); }
static string OpenApiMessageToString(ProtoMessage msg) { switch ((ProtoOAPayloadType)msg.PayloadType) { case ProtoOAPayloadType.OA_AUTH_REQ: var _auth_req = ProtoOAAuthReq.CreateBuilder().MergeFrom(msg.Payload).Build(); #if LOG_SENSITIVE_INFO return("AuthRequest{clientId:" + _auth_req.ClientId + ", clientSecret:" + _auth_req.ClientSecret + "}"); #else return("AuthRequest{clientId: *****, clientSecret: *****}"); #endif case ProtoOAPayloadType.OA_AUTH_RES: return("AuthResponse"); case ProtoOAPayloadType.OA_GET_SUBSCRIBED_ACCOUNTS_REQ: return("GetSubscribedAccountsRequest"); case ProtoOAPayloadType.OA_GET_SUBSCRIBED_ACCOUNTS_RES: var _subscr_res = ProtoOAGetSubscribedAccountsRes.CreateBuilder().MergeFrom(msg.Payload).Build(); var _subscr_res_str = "GetSubscribedAccountsResponse{"; var _subscr_count = _subscr_res.AccountIdCount; foreach (var accountId in _subscr_res.AccountIdList) { _subscr_res_str += "accountId:" + accountId.ToString() + (--_subscr_count == 0 ? "" : ", "); } return(_subscr_res_str + "}"); case ProtoOAPayloadType.OA_SUBSCRIBE_FOR_TRADING_EVENTS_REQ: var _subscr_req = ProtoOASubscribeForTradingEventsReq.CreateBuilder().MergeFrom(msg.Payload).Build(); #if LOG_SENSITIVE_INFO return("SubscrbeTradingEventsRequest{accountId:" + _subscr_req.AccountId.ToString() + ", accessToken:" + _subscr_req.AccessToken + "}"); #else return("SubscrbeTradingEventsRequest{accountId: *****, accessToken: *****}"); #endif case ProtoOAPayloadType.OA_SUBSCRIBE_FOR_TRADING_EVENTS_RES: return("SubscrbeTradingEventsResponse"); case ProtoOAPayloadType.OA_UNSUBSCRIBE_FROM_TRADING_EVENTS_REQ: var _unsubscr_req = ProtoOAUnsubscribeFromTradingEventsReq.CreateBuilder().MergeFrom(msg.Payload).Build(); return("UnsubscrbeTradingEventsRequest{accountId:" + _unsubscr_req.AccountId + "}"); case ProtoOAPayloadType.OA_UNSUBSCRIBE_FROM_TRADING_EVENTS_RES: return("UnsubscrbeTradingEventsResponse"); case ProtoOAPayloadType.OA_EXECUTION_EVENT: return(OpenApiExecEventsToString(msg)); case ProtoOAPayloadType.OA_CANCEL_ORDER_REQ: return("CancelOrderRequest{}"); case ProtoOAPayloadType.OA_CREATE_ORDER_REQ: return("CreateOrderRequest{}"); case ProtoOAPayloadType.OA_CLOSE_POSITION_REQ: return("ClosePositionRequest{}"); case ProtoOAPayloadType.OA_AMEND_ORDER_REQ: return("AmendOrderRequest{}"); case ProtoOAPayloadType.OA_AMEND_POSITION_SL_TP_REQ: return("AmendPositionRequest{}"); case ProtoOAPayloadType.OA_SUBSCRIBE_FOR_SPOTS_REQ: return("SubscribeForSpotsRequest{}"); case ProtoOAPayloadType.OA_SUBSCRIBE_FOR_SPOTS_RES: return("SubscribeForSpotsResponse{}"); case ProtoOAPayloadType.OA_UNSUBSCRIBE_FROM_SPOTS_REQ: return("UnsubscribeFromSpotsRequest{}"); case ProtoOAPayloadType.OA_UNSUBSCRIBE_FROM_SPOTS_RES: return("UnsubscribeFromSpotsResponse{}"); case ProtoOAPayloadType.OA_GET_SPOT_SUBSCRIPTION_REQ: return("GetSpotSubscriptionRequest{}"); case ProtoOAPayloadType.OA_GET_SPOT_SUBSCRIPTION_RES: return("GetSpotSubscriptionResponse{}"); case ProtoOAPayloadType.OA_GET_ALL_SPOT_SUBSCRIPTIONS_REQ: return("GetAllSpotSubscriptionsRequest{}"); case ProtoOAPayloadType.OA_GET_ALL_SPOT_SUBSCRIPTIONS_RES: String _all_str = "GetAllSpotSubscriptionsResponse{"; ProtoOAGetAllSpotSubscriptionsRes _all_res = ProtoOAGetAllSpotSubscriptionsRes.CreateBuilder().MergeFrom(msg.Payload).Build(); _all_str += "subscriptions=["; foreach (ProtoOASpotSubscription subscription in _all_res.SpotSubscriptionsList) { _all_str += "{AccountId=" + subscription.AccountId + ", SubscriptionId=" + subscription.SubscriptionId + ", SymbolNamesList=["; foreach (String symbolName in subscription.SymbolNamesList) { _all_str += symbolName + ", "; } _all_str += "]}, "; } _all_str += "]}"; return(_all_str); case ProtoOAPayloadType.OA_SPOT_EVENT: var _spot_event = ProtoOASpotEvent.CreateBuilder().MergeFrom(msg.Payload).Build(); return("SpotEvent{subscriptionId:" + _spot_event.SubscriptionId + ", symbolName:" + _spot_event.SymbolName + ", bidPrice:" + (_spot_event.HasBidPrice ? _spot_event.BidPrice.ToString() : " ") + ", askPrice:" + (_spot_event.HasAskPrice ? _spot_event.AskPrice.ToString() : " ") + " " + (new DateTime(1970, 1, 1) + TimeSpan.FromMilliseconds(_spot_event.Timestamp)) + "}"); default: return("unknown"); } }