UNPKG

@tinkoff/invest-js

Version:
1,193 lines (1,192 loc) 70.8 kB
"use strict"; // Code generated by protoc-gen-ts_proto. DO NOT EDIT. // versions: // protoc-gen-ts_proto v2.6.1 // protoc v3.19.1 // source: stoporders.proto Object.defineProperty(exports, "__esModule", { value: true }); exports.StopOrdersServiceDefinition = exports.StopOrder_TrailingData = exports.StopOrder = exports.CancelStopOrderResponse = exports.CancelStopOrderRequest = exports.GetStopOrdersResponse = exports.GetStopOrdersRequest = exports.PostStopOrderResponse = exports.PostStopOrderRequest_TrailingData = exports.PostStopOrderRequest = exports.TrailingStopStatus = exports.TrailingValueType = exports.TakeProfitType = exports.ExchangeOrderType = exports.StopOrderStatusOption = exports.StopOrderType = exports.StopOrderExpirationType = exports.StopOrderDirection = void 0; exports.stopOrderDirectionFromJSON = stopOrderDirectionFromJSON; exports.stopOrderDirectionToJSON = stopOrderDirectionToJSON; exports.stopOrderExpirationTypeFromJSON = stopOrderExpirationTypeFromJSON; exports.stopOrderExpirationTypeToJSON = stopOrderExpirationTypeToJSON; exports.stopOrderTypeFromJSON = stopOrderTypeFromJSON; exports.stopOrderTypeToJSON = stopOrderTypeToJSON; exports.stopOrderStatusOptionFromJSON = stopOrderStatusOptionFromJSON; exports.stopOrderStatusOptionToJSON = stopOrderStatusOptionToJSON; exports.exchangeOrderTypeFromJSON = exchangeOrderTypeFromJSON; exports.exchangeOrderTypeToJSON = exchangeOrderTypeToJSON; exports.takeProfitTypeFromJSON = takeProfitTypeFromJSON; exports.takeProfitTypeToJSON = takeProfitTypeToJSON; exports.trailingValueTypeFromJSON = trailingValueTypeFromJSON; exports.trailingValueTypeToJSON = trailingValueTypeToJSON; exports.trailingStopStatusFromJSON = trailingStopStatusFromJSON; exports.trailingStopStatusToJSON = trailingStopStatusToJSON; /* eslint-disable */ const wire_1 = require("@bufbuild/protobuf/wire"); const common_1 = require("./common"); const timestamp_1 = require("./google/protobuf/timestamp"); /** Направление сделки стоп-заявки. */ var StopOrderDirection; (function (StopOrderDirection) { /** STOP_ORDER_DIRECTION_UNSPECIFIED - Значение не указано. */ StopOrderDirection[StopOrderDirection["STOP_ORDER_DIRECTION_UNSPECIFIED"] = 0] = "STOP_ORDER_DIRECTION_UNSPECIFIED"; /** STOP_ORDER_DIRECTION_BUY - Покупка. */ StopOrderDirection[StopOrderDirection["STOP_ORDER_DIRECTION_BUY"] = 1] = "STOP_ORDER_DIRECTION_BUY"; /** STOP_ORDER_DIRECTION_SELL - Продажа. */ StopOrderDirection[StopOrderDirection["STOP_ORDER_DIRECTION_SELL"] = 2] = "STOP_ORDER_DIRECTION_SELL"; StopOrderDirection[StopOrderDirection["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(StopOrderDirection || (exports.StopOrderDirection = StopOrderDirection = {})); function stopOrderDirectionFromJSON(object) { switch (object) { case 0: case "STOP_ORDER_DIRECTION_UNSPECIFIED": return StopOrderDirection.STOP_ORDER_DIRECTION_UNSPECIFIED; case 1: case "STOP_ORDER_DIRECTION_BUY": return StopOrderDirection.STOP_ORDER_DIRECTION_BUY; case 2: case "STOP_ORDER_DIRECTION_SELL": return StopOrderDirection.STOP_ORDER_DIRECTION_SELL; case -1: case "UNRECOGNIZED": default: return StopOrderDirection.UNRECOGNIZED; } } function stopOrderDirectionToJSON(object) { switch (object) { case StopOrderDirection.STOP_ORDER_DIRECTION_UNSPECIFIED: return "STOP_ORDER_DIRECTION_UNSPECIFIED"; case StopOrderDirection.STOP_ORDER_DIRECTION_BUY: return "STOP_ORDER_DIRECTION_BUY"; case StopOrderDirection.STOP_ORDER_DIRECTION_SELL: return "STOP_ORDER_DIRECTION_SELL"; case StopOrderDirection.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** Тип экспирации стоп-заявке. */ var StopOrderExpirationType; (function (StopOrderExpirationType) { /** STOP_ORDER_EXPIRATION_TYPE_UNSPECIFIED - Значение не указано. */ StopOrderExpirationType[StopOrderExpirationType["STOP_ORDER_EXPIRATION_TYPE_UNSPECIFIED"] = 0] = "STOP_ORDER_EXPIRATION_TYPE_UNSPECIFIED"; /** STOP_ORDER_EXPIRATION_TYPE_GOOD_TILL_CANCEL - Действительно до отмены. */ StopOrderExpirationType[StopOrderExpirationType["STOP_ORDER_EXPIRATION_TYPE_GOOD_TILL_CANCEL"] = 1] = "STOP_ORDER_EXPIRATION_TYPE_GOOD_TILL_CANCEL"; /** STOP_ORDER_EXPIRATION_TYPE_GOOD_TILL_DATE - Действительно до даты снятия. */ StopOrderExpirationType[StopOrderExpirationType["STOP_ORDER_EXPIRATION_TYPE_GOOD_TILL_DATE"] = 2] = "STOP_ORDER_EXPIRATION_TYPE_GOOD_TILL_DATE"; StopOrderExpirationType[StopOrderExpirationType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(StopOrderExpirationType || (exports.StopOrderExpirationType = StopOrderExpirationType = {})); function stopOrderExpirationTypeFromJSON(object) { switch (object) { case 0: case "STOP_ORDER_EXPIRATION_TYPE_UNSPECIFIED": return StopOrderExpirationType.STOP_ORDER_EXPIRATION_TYPE_UNSPECIFIED; case 1: case "STOP_ORDER_EXPIRATION_TYPE_GOOD_TILL_CANCEL": return StopOrderExpirationType.STOP_ORDER_EXPIRATION_TYPE_GOOD_TILL_CANCEL; case 2: case "STOP_ORDER_EXPIRATION_TYPE_GOOD_TILL_DATE": return StopOrderExpirationType.STOP_ORDER_EXPIRATION_TYPE_GOOD_TILL_DATE; case -1: case "UNRECOGNIZED": default: return StopOrderExpirationType.UNRECOGNIZED; } } function stopOrderExpirationTypeToJSON(object) { switch (object) { case StopOrderExpirationType.STOP_ORDER_EXPIRATION_TYPE_UNSPECIFIED: return "STOP_ORDER_EXPIRATION_TYPE_UNSPECIFIED"; case StopOrderExpirationType.STOP_ORDER_EXPIRATION_TYPE_GOOD_TILL_CANCEL: return "STOP_ORDER_EXPIRATION_TYPE_GOOD_TILL_CANCEL"; case StopOrderExpirationType.STOP_ORDER_EXPIRATION_TYPE_GOOD_TILL_DATE: return "STOP_ORDER_EXPIRATION_TYPE_GOOD_TILL_DATE"; case StopOrderExpirationType.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** Тип стоп-заявки. */ var StopOrderType; (function (StopOrderType) { /** STOP_ORDER_TYPE_UNSPECIFIED - Значение не указано. */ StopOrderType[StopOrderType["STOP_ORDER_TYPE_UNSPECIFIED"] = 0] = "STOP_ORDER_TYPE_UNSPECIFIED"; /** STOP_ORDER_TYPE_TAKE_PROFIT - `Take-profit`-заявка. */ StopOrderType[StopOrderType["STOP_ORDER_TYPE_TAKE_PROFIT"] = 1] = "STOP_ORDER_TYPE_TAKE_PROFIT"; /** STOP_ORDER_TYPE_STOP_LOSS - `Stop-loss`-заявка. */ StopOrderType[StopOrderType["STOP_ORDER_TYPE_STOP_LOSS"] = 2] = "STOP_ORDER_TYPE_STOP_LOSS"; /** STOP_ORDER_TYPE_STOP_LIMIT - `Stop-limit`-заявка. */ StopOrderType[StopOrderType["STOP_ORDER_TYPE_STOP_LIMIT"] = 3] = "STOP_ORDER_TYPE_STOP_LIMIT"; StopOrderType[StopOrderType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(StopOrderType || (exports.StopOrderType = StopOrderType = {})); function stopOrderTypeFromJSON(object) { switch (object) { case 0: case "STOP_ORDER_TYPE_UNSPECIFIED": return StopOrderType.STOP_ORDER_TYPE_UNSPECIFIED; case 1: case "STOP_ORDER_TYPE_TAKE_PROFIT": return StopOrderType.STOP_ORDER_TYPE_TAKE_PROFIT; case 2: case "STOP_ORDER_TYPE_STOP_LOSS": return StopOrderType.STOP_ORDER_TYPE_STOP_LOSS; case 3: case "STOP_ORDER_TYPE_STOP_LIMIT": return StopOrderType.STOP_ORDER_TYPE_STOP_LIMIT; case -1: case "UNRECOGNIZED": default: return StopOrderType.UNRECOGNIZED; } } function stopOrderTypeToJSON(object) { switch (object) { case StopOrderType.STOP_ORDER_TYPE_UNSPECIFIED: return "STOP_ORDER_TYPE_UNSPECIFIED"; case StopOrderType.STOP_ORDER_TYPE_TAKE_PROFIT: return "STOP_ORDER_TYPE_TAKE_PROFIT"; case StopOrderType.STOP_ORDER_TYPE_STOP_LOSS: return "STOP_ORDER_TYPE_STOP_LOSS"; case StopOrderType.STOP_ORDER_TYPE_STOP_LIMIT: return "STOP_ORDER_TYPE_STOP_LIMIT"; case StopOrderType.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** Статус стоп-заяки. */ var StopOrderStatusOption; (function (StopOrderStatusOption) { /** STOP_ORDER_STATUS_UNSPECIFIED - Значение не указано. */ StopOrderStatusOption[StopOrderStatusOption["STOP_ORDER_STATUS_UNSPECIFIED"] = 0] = "STOP_ORDER_STATUS_UNSPECIFIED"; /** STOP_ORDER_STATUS_ALL - Все заявки. */ StopOrderStatusOption[StopOrderStatusOption["STOP_ORDER_STATUS_ALL"] = 1] = "STOP_ORDER_STATUS_ALL"; /** STOP_ORDER_STATUS_ACTIVE - Активные заявки. */ StopOrderStatusOption[StopOrderStatusOption["STOP_ORDER_STATUS_ACTIVE"] = 2] = "STOP_ORDER_STATUS_ACTIVE"; /** STOP_ORDER_STATUS_EXECUTED - Исполненные заявки. */ StopOrderStatusOption[StopOrderStatusOption["STOP_ORDER_STATUS_EXECUTED"] = 3] = "STOP_ORDER_STATUS_EXECUTED"; /** STOP_ORDER_STATUS_CANCELED - Отменённые заявки. */ StopOrderStatusOption[StopOrderStatusOption["STOP_ORDER_STATUS_CANCELED"] = 4] = "STOP_ORDER_STATUS_CANCELED"; /** STOP_ORDER_STATUS_EXPIRED - Истёкшие заявки. */ StopOrderStatusOption[StopOrderStatusOption["STOP_ORDER_STATUS_EXPIRED"] = 5] = "STOP_ORDER_STATUS_EXPIRED"; StopOrderStatusOption[StopOrderStatusOption["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(StopOrderStatusOption || (exports.StopOrderStatusOption = StopOrderStatusOption = {})); function stopOrderStatusOptionFromJSON(object) { switch (object) { case 0: case "STOP_ORDER_STATUS_UNSPECIFIED": return StopOrderStatusOption.STOP_ORDER_STATUS_UNSPECIFIED; case 1: case "STOP_ORDER_STATUS_ALL": return StopOrderStatusOption.STOP_ORDER_STATUS_ALL; case 2: case "STOP_ORDER_STATUS_ACTIVE": return StopOrderStatusOption.STOP_ORDER_STATUS_ACTIVE; case 3: case "STOP_ORDER_STATUS_EXECUTED": return StopOrderStatusOption.STOP_ORDER_STATUS_EXECUTED; case 4: case "STOP_ORDER_STATUS_CANCELED": return StopOrderStatusOption.STOP_ORDER_STATUS_CANCELED; case 5: case "STOP_ORDER_STATUS_EXPIRED": return StopOrderStatusOption.STOP_ORDER_STATUS_EXPIRED; case -1: case "UNRECOGNIZED": default: return StopOrderStatusOption.UNRECOGNIZED; } } function stopOrderStatusOptionToJSON(object) { switch (object) { case StopOrderStatusOption.STOP_ORDER_STATUS_UNSPECIFIED: return "STOP_ORDER_STATUS_UNSPECIFIED"; case StopOrderStatusOption.STOP_ORDER_STATUS_ALL: return "STOP_ORDER_STATUS_ALL"; case StopOrderStatusOption.STOP_ORDER_STATUS_ACTIVE: return "STOP_ORDER_STATUS_ACTIVE"; case StopOrderStatusOption.STOP_ORDER_STATUS_EXECUTED: return "STOP_ORDER_STATUS_EXECUTED"; case StopOrderStatusOption.STOP_ORDER_STATUS_CANCELED: return "STOP_ORDER_STATUS_CANCELED"; case StopOrderStatusOption.STOP_ORDER_STATUS_EXPIRED: return "STOP_ORDER_STATUS_EXPIRED"; case StopOrderStatusOption.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** Тип выставляемой заявки. */ var ExchangeOrderType; (function (ExchangeOrderType) { /** EXCHANGE_ORDER_TYPE_UNSPECIFIED - Значение не указано. */ ExchangeOrderType[ExchangeOrderType["EXCHANGE_ORDER_TYPE_UNSPECIFIED"] = 0] = "EXCHANGE_ORDER_TYPE_UNSPECIFIED"; /** EXCHANGE_ORDER_TYPE_MARKET - Заявка по рыночной цене. */ ExchangeOrderType[ExchangeOrderType["EXCHANGE_ORDER_TYPE_MARKET"] = 1] = "EXCHANGE_ORDER_TYPE_MARKET"; /** EXCHANGE_ORDER_TYPE_LIMIT - Лимитная заявка. */ ExchangeOrderType[ExchangeOrderType["EXCHANGE_ORDER_TYPE_LIMIT"] = 2] = "EXCHANGE_ORDER_TYPE_LIMIT"; ExchangeOrderType[ExchangeOrderType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(ExchangeOrderType || (exports.ExchangeOrderType = ExchangeOrderType = {})); function exchangeOrderTypeFromJSON(object) { switch (object) { case 0: case "EXCHANGE_ORDER_TYPE_UNSPECIFIED": return ExchangeOrderType.EXCHANGE_ORDER_TYPE_UNSPECIFIED; case 1: case "EXCHANGE_ORDER_TYPE_MARKET": return ExchangeOrderType.EXCHANGE_ORDER_TYPE_MARKET; case 2: case "EXCHANGE_ORDER_TYPE_LIMIT": return ExchangeOrderType.EXCHANGE_ORDER_TYPE_LIMIT; case -1: case "UNRECOGNIZED": default: return ExchangeOrderType.UNRECOGNIZED; } } function exchangeOrderTypeToJSON(object) { switch (object) { case ExchangeOrderType.EXCHANGE_ORDER_TYPE_UNSPECIFIED: return "EXCHANGE_ORDER_TYPE_UNSPECIFIED"; case ExchangeOrderType.EXCHANGE_ORDER_TYPE_MARKET: return "EXCHANGE_ORDER_TYPE_MARKET"; case ExchangeOrderType.EXCHANGE_ORDER_TYPE_LIMIT: return "EXCHANGE_ORDER_TYPE_LIMIT"; case ExchangeOrderType.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** Тип TakeProfit-заявки. */ var TakeProfitType; (function (TakeProfitType) { /** TAKE_PROFIT_TYPE_UNSPECIFIED - Значение не указано. */ TakeProfitType[TakeProfitType["TAKE_PROFIT_TYPE_UNSPECIFIED"] = 0] = "TAKE_PROFIT_TYPE_UNSPECIFIED"; /** TAKE_PROFIT_TYPE_REGULAR - Обычная заявка, значение по умолчанию. */ TakeProfitType[TakeProfitType["TAKE_PROFIT_TYPE_REGULAR"] = 1] = "TAKE_PROFIT_TYPE_REGULAR"; /** TAKE_PROFIT_TYPE_TRAILING - Трейлинг-стоп. */ TakeProfitType[TakeProfitType["TAKE_PROFIT_TYPE_TRAILING"] = 2] = "TAKE_PROFIT_TYPE_TRAILING"; TakeProfitType[TakeProfitType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(TakeProfitType || (exports.TakeProfitType = TakeProfitType = {})); function takeProfitTypeFromJSON(object) { switch (object) { case 0: case "TAKE_PROFIT_TYPE_UNSPECIFIED": return TakeProfitType.TAKE_PROFIT_TYPE_UNSPECIFIED; case 1: case "TAKE_PROFIT_TYPE_REGULAR": return TakeProfitType.TAKE_PROFIT_TYPE_REGULAR; case 2: case "TAKE_PROFIT_TYPE_TRAILING": return TakeProfitType.TAKE_PROFIT_TYPE_TRAILING; case -1: case "UNRECOGNIZED": default: return TakeProfitType.UNRECOGNIZED; } } function takeProfitTypeToJSON(object) { switch (object) { case TakeProfitType.TAKE_PROFIT_TYPE_UNSPECIFIED: return "TAKE_PROFIT_TYPE_UNSPECIFIED"; case TakeProfitType.TAKE_PROFIT_TYPE_REGULAR: return "TAKE_PROFIT_TYPE_REGULAR"; case TakeProfitType.TAKE_PROFIT_TYPE_TRAILING: return "TAKE_PROFIT_TYPE_TRAILING"; case TakeProfitType.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** Тип параметров значений трейлинг-стопа. */ var TrailingValueType; (function (TrailingValueType) { /** TRAILING_VALUE_UNSPECIFIED - Значение не указано. */ TrailingValueType[TrailingValueType["TRAILING_VALUE_UNSPECIFIED"] = 0] = "TRAILING_VALUE_UNSPECIFIED"; /** TRAILING_VALUE_ABSOLUTE - Абсолютное значение в единицах цены. */ TrailingValueType[TrailingValueType["TRAILING_VALUE_ABSOLUTE"] = 1] = "TRAILING_VALUE_ABSOLUTE"; /** TRAILING_VALUE_RELATIVE - Относительное значение в процентах. */ TrailingValueType[TrailingValueType["TRAILING_VALUE_RELATIVE"] = 2] = "TRAILING_VALUE_RELATIVE"; TrailingValueType[TrailingValueType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(TrailingValueType || (exports.TrailingValueType = TrailingValueType = {})); function trailingValueTypeFromJSON(object) { switch (object) { case 0: case "TRAILING_VALUE_UNSPECIFIED": return TrailingValueType.TRAILING_VALUE_UNSPECIFIED; case 1: case "TRAILING_VALUE_ABSOLUTE": return TrailingValueType.TRAILING_VALUE_ABSOLUTE; case 2: case "TRAILING_VALUE_RELATIVE": return TrailingValueType.TRAILING_VALUE_RELATIVE; case -1: case "UNRECOGNIZED": default: return TrailingValueType.UNRECOGNIZED; } } function trailingValueTypeToJSON(object) { switch (object) { case TrailingValueType.TRAILING_VALUE_UNSPECIFIED: return "TRAILING_VALUE_UNSPECIFIED"; case TrailingValueType.TRAILING_VALUE_ABSOLUTE: return "TRAILING_VALUE_ABSOLUTE"; case TrailingValueType.TRAILING_VALUE_RELATIVE: return "TRAILING_VALUE_RELATIVE"; case TrailingValueType.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** Статус трейлинг-стопа. */ var TrailingStopStatus; (function (TrailingStopStatus) { /** TRAILING_STOP_UNSPECIFIED - Значение не указано. */ TrailingStopStatus[TrailingStopStatus["TRAILING_STOP_UNSPECIFIED"] = 0] = "TRAILING_STOP_UNSPECIFIED"; /** TRAILING_STOP_ACTIVE - Активный. */ TrailingStopStatus[TrailingStopStatus["TRAILING_STOP_ACTIVE"] = 1] = "TRAILING_STOP_ACTIVE"; /** TRAILING_STOP_ACTIVATED - Активированный. */ TrailingStopStatus[TrailingStopStatus["TRAILING_STOP_ACTIVATED"] = 2] = "TRAILING_STOP_ACTIVATED"; TrailingStopStatus[TrailingStopStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(TrailingStopStatus || (exports.TrailingStopStatus = TrailingStopStatus = {})); function trailingStopStatusFromJSON(object) { switch (object) { case 0: case "TRAILING_STOP_UNSPECIFIED": return TrailingStopStatus.TRAILING_STOP_UNSPECIFIED; case 1: case "TRAILING_STOP_ACTIVE": return TrailingStopStatus.TRAILING_STOP_ACTIVE; case 2: case "TRAILING_STOP_ACTIVATED": return TrailingStopStatus.TRAILING_STOP_ACTIVATED; case -1: case "UNRECOGNIZED": default: return TrailingStopStatus.UNRECOGNIZED; } } function trailingStopStatusToJSON(object) { switch (object) { case TrailingStopStatus.TRAILING_STOP_UNSPECIFIED: return "TRAILING_STOP_UNSPECIFIED"; case TrailingStopStatus.TRAILING_STOP_ACTIVE: return "TRAILING_STOP_ACTIVE"; case TrailingStopStatus.TRAILING_STOP_ACTIVATED: return "TRAILING_STOP_ACTIVATED"; case TrailingStopStatus.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } function createBasePostStopOrderRequest() { return { figi: undefined, quantity: 0, price: undefined, stopPrice: undefined, direction: 0, accountId: "", expirationType: 0, stopOrderType: 0, expireDate: undefined, instrumentId: "", exchangeOrderType: 0, takeProfitType: 0, trailingData: undefined, priceType: 0, orderId: "", }; } exports.PostStopOrderRequest = { encode(message, writer = new wire_1.BinaryWriter()) { if (message.figi !== undefined) { writer.uint32(10).string(message.figi); } if (message.quantity !== 0) { writer.uint32(16).int64(message.quantity); } if (message.price !== undefined) { common_1.Quotation.encode(message.price, writer.uint32(26).fork()).join(); } if (message.stopPrice !== undefined) { common_1.Quotation.encode(message.stopPrice, writer.uint32(34).fork()).join(); } if (message.direction !== 0) { writer.uint32(40).int32(message.direction); } if (message.accountId !== "") { writer.uint32(50).string(message.accountId); } if (message.expirationType !== 0) { writer.uint32(56).int32(message.expirationType); } if (message.stopOrderType !== 0) { writer.uint32(64).int32(message.stopOrderType); } if (message.expireDate !== undefined) { timestamp_1.Timestamp.encode(toTimestamp(message.expireDate), writer.uint32(74).fork()).join(); } if (message.instrumentId !== "") { writer.uint32(82).string(message.instrumentId); } if (message.exchangeOrderType !== 0) { writer.uint32(88).int32(message.exchangeOrderType); } if (message.takeProfitType !== 0) { writer.uint32(96).int32(message.takeProfitType); } if (message.trailingData !== undefined) { exports.PostStopOrderRequest_TrailingData.encode(message.trailingData, writer.uint32(106).fork()).join(); } if (message.priceType !== 0) { writer.uint32(112).int32(message.priceType); } if (message.orderId !== "") { writer.uint32(122).string(message.orderId); } return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePostStopOrderRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.figi = reader.string(); continue; } case 2: { if (tag !== 16) { break; } message.quantity = longToNumber(reader.int64()); continue; } case 3: { if (tag !== 26) { break; } message.price = common_1.Quotation.decode(reader, reader.uint32()); continue; } case 4: { if (tag !== 34) { break; } message.stopPrice = common_1.Quotation.decode(reader, reader.uint32()); continue; } case 5: { if (tag !== 40) { break; } message.direction = reader.int32(); continue; } case 6: { if (tag !== 50) { break; } message.accountId = reader.string(); continue; } case 7: { if (tag !== 56) { break; } message.expirationType = reader.int32(); continue; } case 8: { if (tag !== 64) { break; } message.stopOrderType = reader.int32(); continue; } case 9: { if (tag !== 74) { break; } message.expireDate = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32())); continue; } case 10: { if (tag !== 82) { break; } message.instrumentId = reader.string(); continue; } case 11: { if (tag !== 88) { break; } message.exchangeOrderType = reader.int32(); continue; } case 12: { if (tag !== 96) { break; } message.takeProfitType = reader.int32(); continue; } case 13: { if (tag !== 106) { break; } message.trailingData = exports.PostStopOrderRequest_TrailingData.decode(reader, reader.uint32()); continue; } case 14: { if (tag !== 112) { break; } message.priceType = reader.int32(); continue; } case 15: { if (tag !== 122) { break; } message.orderId = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { figi: isSet(object.figi) ? globalThis.String(object.figi) : undefined, quantity: isSet(object.quantity) ? globalThis.Number(object.quantity) : 0, price: isSet(object.price) ? common_1.Quotation.fromJSON(object.price) : undefined, stopPrice: isSet(object.stopPrice) ? common_1.Quotation.fromJSON(object.stopPrice) : undefined, direction: isSet(object.direction) ? stopOrderDirectionFromJSON(object.direction) : 0, accountId: isSet(object.accountId) ? globalThis.String(object.accountId) : "", expirationType: isSet(object.expirationType) ? stopOrderExpirationTypeFromJSON(object.expirationType) : 0, stopOrderType: isSet(object.stopOrderType) ? stopOrderTypeFromJSON(object.stopOrderType) : 0, expireDate: isSet(object.expireDate) ? fromJsonTimestamp(object.expireDate) : undefined, instrumentId: isSet(object.instrumentId) ? globalThis.String(object.instrumentId) : "", exchangeOrderType: isSet(object.exchangeOrderType) ? exchangeOrderTypeFromJSON(object.exchangeOrderType) : 0, takeProfitType: isSet(object.takeProfitType) ? takeProfitTypeFromJSON(object.takeProfitType) : 0, trailingData: isSet(object.trailingData) ? exports.PostStopOrderRequest_TrailingData.fromJSON(object.trailingData) : undefined, priceType: isSet(object.priceType) ? (0, common_1.priceTypeFromJSON)(object.priceType) : 0, orderId: isSet(object.orderId) ? globalThis.String(object.orderId) : "", }; }, toJSON(message) { const obj = {}; if (message.figi !== undefined) { obj.figi = message.figi; } if (message.quantity !== 0) { obj.quantity = Math.round(message.quantity); } if (message.price !== undefined) { obj.price = common_1.Quotation.toJSON(message.price); } if (message.stopPrice !== undefined) { obj.stopPrice = common_1.Quotation.toJSON(message.stopPrice); } if (message.direction !== 0) { obj.direction = stopOrderDirectionToJSON(message.direction); } if (message.accountId !== "") { obj.accountId = message.accountId; } if (message.expirationType !== 0) { obj.expirationType = stopOrderExpirationTypeToJSON(message.expirationType); } if (message.stopOrderType !== 0) { obj.stopOrderType = stopOrderTypeToJSON(message.stopOrderType); } if (message.expireDate !== undefined) { obj.expireDate = message.expireDate.toISOString(); } if (message.instrumentId !== "") { obj.instrumentId = message.instrumentId; } if (message.exchangeOrderType !== 0) { obj.exchangeOrderType = exchangeOrderTypeToJSON(message.exchangeOrderType); } if (message.takeProfitType !== 0) { obj.takeProfitType = takeProfitTypeToJSON(message.takeProfitType); } if (message.trailingData !== undefined) { obj.trailingData = exports.PostStopOrderRequest_TrailingData.toJSON(message.trailingData); } if (message.priceType !== 0) { obj.priceType = (0, common_1.priceTypeToJSON)(message.priceType); } if (message.orderId !== "") { obj.orderId = message.orderId; } return obj; }, create(base) { return exports.PostStopOrderRequest.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; const message = createBasePostStopOrderRequest(); message.figi = (_a = object.figi) !== null && _a !== void 0 ? _a : undefined; message.quantity = (_b = object.quantity) !== null && _b !== void 0 ? _b : 0; message.price = (object.price !== undefined && object.price !== null) ? common_1.Quotation.fromPartial(object.price) : undefined; message.stopPrice = (object.stopPrice !== undefined && object.stopPrice !== null) ? common_1.Quotation.fromPartial(object.stopPrice) : undefined; message.direction = (_c = object.direction) !== null && _c !== void 0 ? _c : 0; message.accountId = (_d = object.accountId) !== null && _d !== void 0 ? _d : ""; message.expirationType = (_e = object.expirationType) !== null && _e !== void 0 ? _e : 0; message.stopOrderType = (_f = object.stopOrderType) !== null && _f !== void 0 ? _f : 0; message.expireDate = (_g = object.expireDate) !== null && _g !== void 0 ? _g : undefined; message.instrumentId = (_h = object.instrumentId) !== null && _h !== void 0 ? _h : ""; message.exchangeOrderType = (_j = object.exchangeOrderType) !== null && _j !== void 0 ? _j : 0; message.takeProfitType = (_k = object.takeProfitType) !== null && _k !== void 0 ? _k : 0; message.trailingData = (object.trailingData !== undefined && object.trailingData !== null) ? exports.PostStopOrderRequest_TrailingData.fromPartial(object.trailingData) : undefined; message.priceType = (_l = object.priceType) !== null && _l !== void 0 ? _l : 0; message.orderId = (_m = object.orderId) !== null && _m !== void 0 ? _m : ""; return message; }, }; function createBasePostStopOrderRequest_TrailingData() { return { indent: undefined, indentType: 0, spread: undefined, spreadType: 0 }; } exports.PostStopOrderRequest_TrailingData = { encode(message, writer = new wire_1.BinaryWriter()) { if (message.indent !== undefined) { common_1.Quotation.encode(message.indent, writer.uint32(10).fork()).join(); } if (message.indentType !== 0) { writer.uint32(16).int32(message.indentType); } if (message.spread !== undefined) { common_1.Quotation.encode(message.spread, writer.uint32(26).fork()).join(); } if (message.spreadType !== 0) { writer.uint32(32).int32(message.spreadType); } return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePostStopOrderRequest_TrailingData(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.indent = common_1.Quotation.decode(reader, reader.uint32()); continue; } case 2: { if (tag !== 16) { break; } message.indentType = reader.int32(); continue; } case 3: { if (tag !== 26) { break; } message.spread = common_1.Quotation.decode(reader, reader.uint32()); continue; } case 4: { if (tag !== 32) { break; } message.spreadType = reader.int32(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { indent: isSet(object.indent) ? common_1.Quotation.fromJSON(object.indent) : undefined, indentType: isSet(object.indentType) ? trailingValueTypeFromJSON(object.indentType) : 0, spread: isSet(object.spread) ? common_1.Quotation.fromJSON(object.spread) : undefined, spreadType: isSet(object.spreadType) ? trailingValueTypeFromJSON(object.spreadType) : 0, }; }, toJSON(message) { const obj = {}; if (message.indent !== undefined) { obj.indent = common_1.Quotation.toJSON(message.indent); } if (message.indentType !== 0) { obj.indentType = trailingValueTypeToJSON(message.indentType); } if (message.spread !== undefined) { obj.spread = common_1.Quotation.toJSON(message.spread); } if (message.spreadType !== 0) { obj.spreadType = trailingValueTypeToJSON(message.spreadType); } return obj; }, create(base) { return exports.PostStopOrderRequest_TrailingData.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b; const message = createBasePostStopOrderRequest_TrailingData(); message.indent = (object.indent !== undefined && object.indent !== null) ? common_1.Quotation.fromPartial(object.indent) : undefined; message.indentType = (_a = object.indentType) !== null && _a !== void 0 ? _a : 0; message.spread = (object.spread !== undefined && object.spread !== null) ? common_1.Quotation.fromPartial(object.spread) : undefined; message.spreadType = (_b = object.spreadType) !== null && _b !== void 0 ? _b : 0; return message; }, }; function createBasePostStopOrderResponse() { return { stopOrderId: "", orderRequestId: "", responseMetadata: undefined }; } exports.PostStopOrderResponse = { encode(message, writer = new wire_1.BinaryWriter()) { if (message.stopOrderId !== "") { writer.uint32(10).string(message.stopOrderId); } if (message.orderRequestId !== "") { writer.uint32(18).string(message.orderRequestId); } if (message.responseMetadata !== undefined) { common_1.ResponseMetadata.encode(message.responseMetadata, writer.uint32(2034).fork()).join(); } return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBasePostStopOrderResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.stopOrderId = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.orderRequestId = reader.string(); continue; } case 254: { if (tag !== 2034) { break; } message.responseMetadata = common_1.ResponseMetadata.decode(reader, reader.uint32()); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { stopOrderId: isSet(object.stopOrderId) ? globalThis.String(object.stopOrderId) : "", orderRequestId: isSet(object.orderRequestId) ? globalThis.String(object.orderRequestId) : "", responseMetadata: isSet(object.responseMetadata) ? common_1.ResponseMetadata.fromJSON(object.responseMetadata) : undefined, }; }, toJSON(message) { const obj = {}; if (message.stopOrderId !== "") { obj.stopOrderId = message.stopOrderId; } if (message.orderRequestId !== "") { obj.orderRequestId = message.orderRequestId; } if (message.responseMetadata !== undefined) { obj.responseMetadata = common_1.ResponseMetadata.toJSON(message.responseMetadata); } return obj; }, create(base) { return exports.PostStopOrderResponse.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b; const message = createBasePostStopOrderResponse(); message.stopOrderId = (_a = object.stopOrderId) !== null && _a !== void 0 ? _a : ""; message.orderRequestId = (_b = object.orderRequestId) !== null && _b !== void 0 ? _b : ""; message.responseMetadata = (object.responseMetadata !== undefined && object.responseMetadata !== null) ? common_1.ResponseMetadata.fromPartial(object.responseMetadata) : undefined; return message; }, }; function createBaseGetStopOrdersRequest() { return { accountId: "", status: 0, from: undefined, to: undefined }; } exports.GetStopOrdersRequest = { encode(message, writer = new wire_1.BinaryWriter()) { if (message.accountId !== "") { writer.uint32(10).string(message.accountId); } if (message.status !== 0) { writer.uint32(16).int32(message.status); } if (message.from !== undefined) { timestamp_1.Timestamp.encode(toTimestamp(message.from), writer.uint32(26).fork()).join(); } if (message.to !== undefined) { timestamp_1.Timestamp.encode(toTimestamp(message.to), writer.uint32(34).fork()).join(); } return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGetStopOrdersRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.accountId = reader.string(); continue; } case 2: { if (tag !== 16) { break; } message.status = reader.int32(); continue; } case 3: { if (tag !== 26) { break; } message.from = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32())); continue; } case 4: { if (tag !== 34) { break; } message.to = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32())); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { accountId: isSet(object.accountId) ? globalThis.String(object.accountId) : "", status: isSet(object.status) ? stopOrderStatusOptionFromJSON(object.status) : 0, from: isSet(object.from) ? fromJsonTimestamp(object.from) : undefined, to: isSet(object.to) ? fromJsonTimestamp(object.to) : undefined, }; }, toJSON(message) { const obj = {}; if (message.accountId !== "") { obj.accountId = message.accountId; } if (message.status !== 0) { obj.status = stopOrderStatusOptionToJSON(message.status); } if (message.from !== undefined) { obj.from = message.from.toISOString(); } if (message.to !== undefined) { obj.to = message.to.toISOString(); } return obj; }, create(base) { return exports.GetStopOrdersRequest.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d; const message = createBaseGetStopOrdersRequest(); message.accountId = (_a = object.accountId) !== null && _a !== void 0 ? _a : ""; message.status = (_b = object.status) !== null && _b !== void 0 ? _b : 0; message.from = (_c = object.from) !== null && _c !== void 0 ? _c : undefined; message.to = (_d = object.to) !== null && _d !== void 0 ? _d : undefined; return message; }, }; function createBaseGetStopOrdersResponse() { return { stopOrders: [] }; } exports.GetStopOrdersResponse = { encode(message, writer = new wire_1.BinaryWriter()) { for (const v of message.stopOrders) { exports.StopOrder.encode(v, writer.uint32(10).fork()).join(); } return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGetStopOrdersResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.stopOrders.push(exports.StopOrder.decode(reader, reader.uint32())); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { stopOrders: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.stopOrders) ? object.stopOrders.map((e) => exports.StopOrder.fromJSON(e)) : [], }; }, toJSON(message) { var _a; const obj = {}; if ((_a = message.stopOrders) === null || _a === void 0 ? void 0 : _a.length) { obj.stopOrders = message.stopOrders.map((e) => exports.StopOrder.toJSON(e)); } return obj; }, create(base) { return exports.GetStopOrdersResponse.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a; const message = createBaseGetStopOrdersResponse(); message.stopOrders = ((_a = object.stopOrders) === null || _a === void 0 ? void 0 : _a.map((e) => exports.StopOrder.fromPartial(e))) || []; return message; }, }; function createBaseCancelStopOrderRequest() { return { accountId: "", stopOrderId: "" }; } exports.CancelStopOrderRequest = { encode(message, writer = new wire_1.BinaryWriter()) { if (message.accountId !== "") { writer.uint32(10).string(message.accountId); } if (message.stopOrderId !== "") { writer.uint32(18).string(message.stopOrderId); } return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCancelStopOrderRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.accountId = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.stopOrderId = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { accountId: isSet(object.accountId) ? globalThis.String(object.accountId) : "", stopOrderId: isSet(object.stopOrderId) ? globalThis.String(object.stopOrderId) : "", }; }, toJSON(message) { const obj = {}; if (message.accountId !== "") { obj.accountId = message.accountId; } if (message.stopOrderId !== "") { obj.stopOrderId = message.stopOrderId; } return obj; }, create(base) { return exports.CancelStopOrderRequest.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b; const message = createBaseCancelStopOrderRequest(); message.accountId = (_a = object.accountId) !== null && _a !== void 0 ? _a : ""; message.stopOrderId = (_b = object.stopOrderId) !== null && _b !== void 0 ? _b : ""; return message; }, }; function createBaseCancelStopOrderResponse() { return { time: undefined }; } exports.CancelStopOrderResponse = { encode(message, writer = new wire_1.BinaryWriter()) { if (message.time !== undefined) { timestamp_1.Timestamp.encode(toTimestamp(message.time), writer.uint32(10).fork()).join(); } return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCancelStopOrderResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.time = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32())); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined }; }, toJSON(message) { const obj = {}; if (message.time !== undefined) { obj.time = message.time.toISOString(); } return obj; }, create(base) { return exports.CancelStopOrderResponse.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a; const message = createBaseCancelStopOrderResponse(); message.time = (_a = object.time) !== null && _a !== void 0 ? _a : undefined; return message; }, }; function createBaseStopOrder() { return { stopOrderId: "", lotsRequested: 0, figi: "", direction: 0, currency: "", orderType: 0, createDate: undefined, activationDateTime: undefined, expirationTime: undefined, price: undefined, stopPrice: undefined, instrumentUid: "", takeProfitType: 0, trailingData: undefined, status: 0, exchangeOrderType: 0, exchangeOrderId: undefined, }; } exports.StopOrder = { encode(message, writer = new wire_1.BinaryWriter()) { if (message.stopOrderId !== "") { writer.uint32(10).string(message.stopOrderId); } if (message.lotsRequested !== 0) { writer.uint32(16).int64(message.lotsRequested); } if (message.figi !== "") { writer.uint32(26).string(message.figi); } if (message.direction !== 0) { writer.uint32(32).int32(message.direction); } if (message.currency !== "") { writer.uint32(42).string(message.currency); } if (message.orderType !== 0) { writer.uint32(48).int32(message.orderType); } if (message.createDate !== undefined) { timestamp_1.Timestamp.encode(toTimestamp(message.createDate), writer.uint32(58).fork()).join(); } if (message.activationDateTime !== undefined) { timestamp_1.Timestamp.encode(toTimestamp(message.activationDateTime), writer.uint32(66).fork()).join(); } if (message.expirationTime !== undefined) { timestamp_1.Timestamp.encode(toTimestamp(message.expirationTime), writer.uint32(74).fork()).join(); } if (message.price !== undefined) { common_1.MoneyValue.encode(message.price, writer.uint32(82).fork()).join(); } if (message.stopPrice !== undefined) {