UNPKG

@tinkoff/invest-js

Version:
1 lines 2.56 MB
{"version":3,"file":"index.modern.mjs","sources":["../node_modules/@bufbuild/protobuf/dist/esm/wire/varint.js","../node_modules/@bufbuild/protobuf/dist/esm/proto-int64.js","../node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.js","../node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.js","../src/api/google/protobuf/timestamp.ts","../src/api/common.ts","../src/api/instruments.ts","../src/api/orders.ts","../src/api/operations.ts","../src/api/marketdata.ts","../src/api/stoporders.ts","../src/api/users.ts","../src/client2.ts","../src/api/sandbox.ts","../src/sandbox-client.ts"],"sourcesContent":["// Copyright 2008 Google Inc. All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n// * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n// * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n// * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Code generated by the Protocol Buffer compiler is owned by the owner\n// of the input file used when generating it. This code is not\n// standalone and requires a support library to be linked with it. This\n// support library is itself covered by the above license.\n/* eslint-disable prefer-const,@typescript-eslint/restrict-plus-operands */\n/**\n * Read a 64 bit varint as two JS numbers.\n *\n * Returns tuple:\n * [0]: low bits\n * [1]: high bits\n *\n * Copyright 2008 Google Inc. All rights reserved.\n *\n * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L175\n */\nexport function varint64read() {\n let lowBits = 0;\n let highBits = 0;\n for (let shift = 0; shift < 28; shift += 7) {\n let b = this.buf[this.pos++];\n lowBits |= (b & 0x7f) << shift;\n if ((b & 0x80) == 0) {\n this.assertBounds();\n return [lowBits, highBits];\n }\n }\n let middleByte = this.buf[this.pos++];\n // last four bits of the first 32 bit number\n lowBits |= (middleByte & 0x0f) << 28;\n // 3 upper bits are part of the next 32 bit number\n highBits = (middleByte & 0x70) >> 4;\n if ((middleByte & 0x80) == 0) {\n this.assertBounds();\n return [lowBits, highBits];\n }\n for (let shift = 3; shift <= 31; shift += 7) {\n let b = this.buf[this.pos++];\n highBits |= (b & 0x7f) << shift;\n if ((b & 0x80) == 0) {\n this.assertBounds();\n return [lowBits, highBits];\n }\n }\n throw new Error(\"invalid varint\");\n}\n/**\n * Write a 64 bit varint, given as two JS numbers, to the given bytes array.\n *\n * Copyright 2008 Google Inc. All rights reserved.\n *\n * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/writer.js#L344\n */\nexport function varint64write(lo, hi, bytes) {\n for (let i = 0; i < 28; i = i + 7) {\n const shift = lo >>> i;\n const hasNext = !(shift >>> 7 == 0 && hi == 0);\n const byte = (hasNext ? shift | 0x80 : shift) & 0xff;\n bytes.push(byte);\n if (!hasNext) {\n return;\n }\n }\n const splitBits = ((lo >>> 28) & 0x0f) | ((hi & 0x07) << 4);\n const hasMoreBits = !(hi >> 3 == 0);\n bytes.push((hasMoreBits ? splitBits | 0x80 : splitBits) & 0xff);\n if (!hasMoreBits) {\n return;\n }\n for (let i = 3; i < 31; i = i + 7) {\n const shift = hi >>> i;\n const hasNext = !(shift >>> 7 == 0);\n const byte = (hasNext ? shift | 0x80 : shift) & 0xff;\n bytes.push(byte);\n if (!hasNext) {\n return;\n }\n }\n bytes.push((hi >>> 31) & 0x01);\n}\n// constants for binary math\nconst TWO_PWR_32_DBL = 0x100000000;\n/**\n * Parse decimal string of 64 bit integer value as two JS numbers.\n *\n * Copyright 2008 Google Inc. All rights reserved.\n *\n * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10\n */\nexport function int64FromString(dec) {\n // Check for minus sign.\n const minus = dec[0] === \"-\";\n if (minus) {\n dec = dec.slice(1);\n }\n // Work 6 decimal digits at a time, acting like we're converting base 1e6\n // digits to binary. This is safe to do with floating point math because\n // Number.isSafeInteger(ALL_32_BITS * 1e6) == true.\n const base = 1e6;\n let lowBits = 0;\n let highBits = 0;\n function add1e6digit(begin, end) {\n // Note: Number('') is 0.\n const digit1e6 = Number(dec.slice(begin, end));\n highBits *= base;\n lowBits = lowBits * base + digit1e6;\n // Carry bits from lowBits to\n if (lowBits >= TWO_PWR_32_DBL) {\n highBits = highBits + ((lowBits / TWO_PWR_32_DBL) | 0);\n lowBits = lowBits % TWO_PWR_32_DBL;\n }\n }\n add1e6digit(-24, -18);\n add1e6digit(-18, -12);\n add1e6digit(-12, -6);\n add1e6digit(-6);\n return minus ? negate(lowBits, highBits) : newBits(lowBits, highBits);\n}\n/**\n * Losslessly converts a 64-bit signed integer in 32:32 split representation\n * into a decimal string.\n *\n * Copyright 2008 Google Inc. All rights reserved.\n *\n * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10\n */\nexport function int64ToString(lo, hi) {\n let bits = newBits(lo, hi);\n // If we're treating the input as a signed value and the high bit is set, do\n // a manual two's complement conversion before the decimal conversion.\n const negative = bits.hi & 0x80000000;\n if (negative) {\n bits = negate(bits.lo, bits.hi);\n }\n const result = uInt64ToString(bits.lo, bits.hi);\n return negative ? \"-\" + result : result;\n}\n/**\n * Losslessly converts a 64-bit unsigned integer in 32:32 split representation\n * into a decimal string.\n *\n * Copyright 2008 Google Inc. All rights reserved.\n *\n * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10\n */\nexport function uInt64ToString(lo, hi) {\n ({ lo, hi } = toUnsigned(lo, hi));\n // Skip the expensive conversion if the number is small enough to use the\n // built-in conversions.\n // Number.MAX_SAFE_INTEGER = 0x001FFFFF FFFFFFFF, thus any number with\n // highBits <= 0x1FFFFF can be safely expressed with a double and retain\n // integer precision.\n // Proven by: Number.isSafeInteger(0x1FFFFF * 2**32 + 0xFFFFFFFF) == true.\n if (hi <= 0x1fffff) {\n return String(TWO_PWR_32_DBL * hi + lo);\n }\n // What this code is doing is essentially converting the input number from\n // base-2 to base-1e7, which allows us to represent the 64-bit range with\n // only 3 (very large) digits. Those digits are then trivial to convert to\n // a base-10 string.\n // The magic numbers used here are -\n // 2^24 = 16777216 = (1,6777216) in base-1e7.\n // 2^48 = 281474976710656 = (2,8147497,6710656) in base-1e7.\n // Split 32:32 representation into 16:24:24 representation so our\n // intermediate digits don't overflow.\n const low = lo & 0xffffff;\n const mid = ((lo >>> 24) | (hi << 8)) & 0xffffff;\n const high = (hi >> 16) & 0xffff;\n // Assemble our three base-1e7 digits, ignoring carries. The maximum\n // value in a digit at this step is representable as a 48-bit integer, which\n // can be stored in a 64-bit floating point number.\n let digitA = low + mid * 6777216 + high * 6710656;\n let digitB = mid + high * 8147497;\n let digitC = high * 2;\n // Apply carries from A to B and from B to C.\n const base = 10000000;\n if (digitA >= base) {\n digitB += Math.floor(digitA / base);\n digitA %= base;\n }\n if (digitB >= base) {\n digitC += Math.floor(digitB / base);\n digitB %= base;\n }\n // If digitC is 0, then we should have returned in the trivial code path\n // at the top for non-safe integers. Given this, we can assume both digitB\n // and digitA need leading zeros.\n return (digitC.toString() +\n decimalFrom1e7WithLeadingZeros(digitB) +\n decimalFrom1e7WithLeadingZeros(digitA));\n}\nfunction toUnsigned(lo, hi) {\n return { lo: lo >>> 0, hi: hi >>> 0 };\n}\nfunction newBits(lo, hi) {\n return { lo: lo | 0, hi: hi | 0 };\n}\n/**\n * Returns two's compliment negation of input.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Signed_32-bit_integers\n */\nfunction negate(lowBits, highBits) {\n highBits = ~highBits;\n if (lowBits) {\n lowBits = ~lowBits + 1;\n }\n else {\n // If lowBits is 0, then bitwise-not is 0xFFFFFFFF,\n // adding 1 to that, results in 0x100000000, which leaves\n // the low bits 0x0 and simply adds one to the high bits.\n highBits += 1;\n }\n return newBits(lowBits, highBits);\n}\n/**\n * Returns decimal representation of digit1e7 with leading zeros.\n */\nconst decimalFrom1e7WithLeadingZeros = (digit1e7) => {\n const partial = String(digit1e7);\n return \"0000000\".slice(partial.length) + partial;\n};\n/**\n * Write a 32 bit varint, signed or unsigned. Same as `varint64write(0, value, bytes)`\n *\n * Copyright 2008 Google Inc. All rights reserved.\n *\n * See https://github.com/protocolbuffers/protobuf/blob/1b18833f4f2a2f681f4e4a25cdf3b0a43115ec26/js/binary/encoder.js#L144\n */\nexport function varint32write(value, bytes) {\n if (value >= 0) {\n // write value as varint 32\n while (value > 0x7f) {\n bytes.push((value & 0x7f) | 0x80);\n value = value >>> 7;\n }\n bytes.push(value);\n }\n else {\n for (let i = 0; i < 9; i++) {\n bytes.push((value & 127) | 128);\n value = value >> 7;\n }\n bytes.push(1);\n }\n}\n/**\n * Read an unsigned 32 bit varint.\n *\n * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L220\n */\nexport function varint32read() {\n let b = this.buf[this.pos++];\n let result = b & 0x7f;\n if ((b & 0x80) == 0) {\n this.assertBounds();\n return result;\n }\n b = this.buf[this.pos++];\n result |= (b & 0x7f) << 7;\n if ((b & 0x80) == 0) {\n this.assertBounds();\n return result;\n }\n b = this.buf[this.pos++];\n result |= (b & 0x7f) << 14;\n if ((b & 0x80) == 0) {\n this.assertBounds();\n return result;\n }\n b = this.buf[this.pos++];\n result |= (b & 0x7f) << 21;\n if ((b & 0x80) == 0) {\n this.assertBounds();\n return result;\n }\n // Extract only last 4 bits\n b = this.buf[this.pos++];\n result |= (b & 0x0f) << 28;\n for (let readBytes = 5; (b & 0x80) !== 0 && readBytes < 10; readBytes++)\n b = this.buf[this.pos++];\n if ((b & 0x80) != 0)\n throw new Error(\"invalid varint\");\n this.assertBounds();\n // Result can have 32 bits, convert it to unsigned\n return result >>> 0;\n}\n","// Copyright 2021-2024 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { int64FromString, int64ToString, uInt64ToString, } from \"./wire/varint.js\";\n/**\n * Int64Support for the current environment.\n */\nexport const protoInt64 = /*@__PURE__*/ makeInt64Support();\nfunction makeInt64Support() {\n const dv = new DataView(new ArrayBuffer(8));\n // note that Safari 14 implements BigInt, but not the DataView methods\n const ok = typeof BigInt === \"function\" &&\n typeof dv.getBigInt64 === \"function\" &&\n typeof dv.getBigUint64 === \"function\" &&\n typeof dv.setBigInt64 === \"function\" &&\n typeof dv.setBigUint64 === \"function\" &&\n (typeof process != \"object\" ||\n typeof process.env != \"object\" ||\n process.env.BUF_BIGINT_DISABLE !== \"1\");\n if (ok) {\n const MIN = BigInt(\"-9223372036854775808\"), MAX = BigInt(\"9223372036854775807\"), UMIN = BigInt(\"0\"), UMAX = BigInt(\"18446744073709551615\");\n return {\n zero: BigInt(0),\n supported: true,\n parse(value) {\n const bi = typeof value == \"bigint\" ? value : BigInt(value);\n if (bi > MAX || bi < MIN) {\n throw new Error(`invalid int64: ${value}`);\n }\n return bi;\n },\n uParse(value) {\n const bi = typeof value == \"bigint\" ? value : BigInt(value);\n if (bi > UMAX || bi < UMIN) {\n throw new Error(`invalid uint64: ${value}`);\n }\n return bi;\n },\n enc(value) {\n dv.setBigInt64(0, this.parse(value), true);\n return {\n lo: dv.getInt32(0, true),\n hi: dv.getInt32(4, true),\n };\n },\n uEnc(value) {\n dv.setBigInt64(0, this.uParse(value), true);\n return {\n lo: dv.getInt32(0, true),\n hi: dv.getInt32(4, true),\n };\n },\n dec(lo, hi) {\n dv.setInt32(0, lo, true);\n dv.setInt32(4, hi, true);\n return dv.getBigInt64(0, true);\n },\n uDec(lo, hi) {\n dv.setInt32(0, lo, true);\n dv.setInt32(4, hi, true);\n return dv.getBigUint64(0, true);\n },\n };\n }\n return {\n zero: \"0\",\n supported: false,\n parse(value) {\n if (typeof value != \"string\") {\n value = value.toString();\n }\n assertInt64String(value);\n return value;\n },\n uParse(value) {\n if (typeof value != \"string\") {\n value = value.toString();\n }\n assertUInt64String(value);\n return value;\n },\n enc(value) {\n if (typeof value != \"string\") {\n value = value.toString();\n }\n assertInt64String(value);\n return int64FromString(value);\n },\n uEnc(value) {\n if (typeof value != \"string\") {\n value = value.toString();\n }\n assertUInt64String(value);\n return int64FromString(value);\n },\n dec(lo, hi) {\n return int64ToString(lo, hi);\n },\n uDec(lo, hi) {\n return uInt64ToString(lo, hi);\n },\n };\n}\nfunction assertInt64String(value) {\n if (!/^-?[0-9]+$/.test(value)) {\n throw new Error(\"invalid int64: \" + value);\n }\n}\nfunction assertUInt64String(value) {\n if (!/^[0-9]+$/.test(value)) {\n throw new Error(\"invalid uint64: \" + value);\n }\n}\n","// Copyright 2021-2024 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nconst symbol = Symbol.for(\"@bufbuild/protobuf/text-encoding\");\n/**\n * Protobuf-ES requires the Text Encoding API to convert UTF-8 from and to\n * binary. This WHATWG API is widely available, but it is not part of the\n * ECMAScript standard. On runtimes where it is not available, use this\n * function to provide your own implementation.\n *\n * Note that the Text Encoding API does not provide a way to validate UTF-8.\n * Our implementation falls back to use encodeURIComponent().\n */\nexport function configureTextEncoding(textEncoding) {\n globalThis[symbol] = textEncoding;\n}\nexport function getTextEncoding() {\n if (globalThis[symbol] == undefined) {\n const te = new globalThis.TextEncoder();\n const td = new globalThis.TextDecoder();\n globalThis[symbol] = {\n encodeUtf8(text) {\n return te.encode(text);\n },\n decodeUtf8(bytes) {\n return td.decode(bytes);\n },\n checkUtf8(text) {\n try {\n encodeURIComponent(text);\n return true;\n }\n catch (e) {\n return false;\n }\n },\n };\n }\n return globalThis[symbol];\n}\n","// Copyright 2021-2024 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { varint32read, varint32write, varint64read, varint64write, } from \"./varint.js\";\nimport { protoInt64 } from \"../proto-int64.js\";\nimport { getTextEncoding } from \"./text-encoding.js\";\n/* eslint-disable prefer-const,no-case-declarations,@typescript-eslint/restrict-plus-operands */\n/**\n * Protobuf binary format wire types.\n *\n * A wire type provides just enough information to find the length of the\n * following value.\n *\n * See https://developers.google.com/protocol-buffers/docs/encoding#structure\n */\nexport var WireType;\n(function (WireType) {\n /**\n * Used for int32, int64, uint32, uint64, sint32, sint64, bool, enum\n */\n WireType[WireType[\"Varint\"] = 0] = \"Varint\";\n /**\n * Used for fixed64, sfixed64, double.\n * Always 8 bytes with little-endian byte order.\n */\n WireType[WireType[\"Bit64\"] = 1] = \"Bit64\";\n /**\n * Used for string, bytes, embedded messages, packed repeated fields\n *\n * Only repeated numeric types (types which use the varint, 32-bit,\n * or 64-bit wire types) can be packed. In proto3, such fields are\n * packed by default.\n */\n WireType[WireType[\"LengthDelimited\"] = 2] = \"LengthDelimited\";\n /**\n * Start of a tag-delimited aggregate, such as a proto2 group, or a message\n * in editions with message_encoding = DELIMITED.\n */\n WireType[WireType[\"StartGroup\"] = 3] = \"StartGroup\";\n /**\n * End of a tag-delimited aggregate.\n */\n WireType[WireType[\"EndGroup\"] = 4] = \"EndGroup\";\n /**\n * Used for fixed32, sfixed32, float.\n * Always 4 bytes with little-endian byte order.\n */\n WireType[WireType[\"Bit32\"] = 5] = \"Bit32\";\n})(WireType || (WireType = {}));\n/**\n * Maximum value for a 32-bit floating point value (Protobuf FLOAT).\n */\nexport const FLOAT32_MAX = 3.4028234663852886e38;\n/**\n * Minimum value for a 32-bit floating point value (Protobuf FLOAT).\n */\nexport const FLOAT32_MIN = -3.4028234663852886e38;\n/**\n * Maximum value for an unsigned 32-bit integer (Protobuf UINT32, FIXED32).\n */\nexport const UINT32_MAX = 0xffffffff;\n/**\n * Maximum value for a signed 32-bit integer (Protobuf INT32, SFIXED32, SINT32).\n */\nexport const INT32_MAX = 0x7fffffff;\n/**\n * Minimum value for a signed 32-bit integer (Protobuf INT32, SFIXED32, SINT32).\n */\nexport const INT32_MIN = -0x80000000;\nexport class BinaryWriter {\n constructor(encodeUtf8 = getTextEncoding().encodeUtf8) {\n this.encodeUtf8 = encodeUtf8;\n /**\n * Previous fork states.\n */\n this.stack = [];\n this.chunks = [];\n this.buf = [];\n }\n /**\n * Return all bytes written and reset this writer.\n */\n finish() {\n if (this.buf.length) {\n this.chunks.push(new Uint8Array(this.buf)); // flush the buffer\n this.buf = [];\n }\n let len = 0;\n for (let i = 0; i < this.chunks.length; i++)\n len += this.chunks[i].length;\n let bytes = new Uint8Array(len);\n let offset = 0;\n for (let i = 0; i < this.chunks.length; i++) {\n bytes.set(this.chunks[i], offset);\n offset += this.chunks[i].length;\n }\n this.chunks = [];\n return bytes;\n }\n /**\n * Start a new fork for length-delimited data like a message\n * or a packed repeated field.\n *\n * Must be joined later with `join()`.\n */\n fork() {\n this.stack.push({ chunks: this.chunks, buf: this.buf });\n this.chunks = [];\n this.buf = [];\n return this;\n }\n /**\n * Join the last fork. Write its length and bytes, then\n * return to the previous state.\n */\n join() {\n // get chunk of fork\n let chunk = this.finish();\n // restore previous state\n let prev = this.stack.pop();\n if (!prev)\n throw new Error(\"invalid state, fork stack empty\");\n this.chunks = prev.chunks;\n this.buf = prev.buf;\n // write length of chunk as varint\n this.uint32(chunk.byteLength);\n return this.raw(chunk);\n }\n /**\n * Writes a tag (field number and wire type).\n *\n * Equivalent to `uint32( (fieldNo << 3 | type) >>> 0 )`.\n *\n * Generated code should compute the tag ahead of time and call `uint32()`.\n */\n tag(fieldNo, type) {\n return this.uint32(((fieldNo << 3) | type) >>> 0);\n }\n /**\n * Write a chunk of raw bytes.\n */\n raw(chunk) {\n if (this.buf.length) {\n this.chunks.push(new Uint8Array(this.buf));\n this.buf = [];\n }\n this.chunks.push(chunk);\n return this;\n }\n /**\n * Write a `uint32` value, an unsigned 32 bit varint.\n */\n uint32(value) {\n assertUInt32(value);\n // write value as varint 32, inlined for speed\n while (value > 0x7f) {\n this.buf.push((value & 0x7f) | 0x80);\n value = value >>> 7;\n }\n this.buf.push(value);\n return this;\n }\n /**\n * Write a `int32` value, a signed 32 bit varint.\n */\n int32(value) {\n assertInt32(value);\n varint32write(value, this.buf);\n return this;\n }\n /**\n * Write a `bool` value, a variant.\n */\n bool(value) {\n this.buf.push(value ? 1 : 0);\n return this;\n }\n /**\n * Write a `bytes` value, length-delimited arbitrary data.\n */\n bytes(value) {\n this.uint32(value.byteLength); // write length of chunk as varint\n return this.raw(value);\n }\n /**\n * Write a `string` value, length-delimited data converted to UTF-8 text.\n */\n string(value) {\n let chunk = this.encodeUtf8(value);\n this.uint32(chunk.byteLength); // write length of chunk as varint\n return this.raw(chunk);\n }\n /**\n * Write a `float` value, 32-bit floating point number.\n */\n float(value) {\n assertFloat32(value);\n let chunk = new Uint8Array(4);\n new DataView(chunk.buffer).setFloat32(0, value, true);\n return this.raw(chunk);\n }\n /**\n * Write a `double` value, a 64-bit floating point number.\n */\n double(value) {\n let chunk = new Uint8Array(8);\n new DataView(chunk.buffer).setFloat64(0, value, true);\n return this.raw(chunk);\n }\n /**\n * Write a `fixed32` value, an unsigned, fixed-length 32-bit integer.\n */\n fixed32(value) {\n assertUInt32(value);\n let chunk = new Uint8Array(4);\n new DataView(chunk.buffer).setUint32(0, value, true);\n return this.raw(chunk);\n }\n /**\n * Write a `sfixed32` value, a signed, fixed-length 32-bit integer.\n */\n sfixed32(value) {\n assertInt32(value);\n let chunk = new Uint8Array(4);\n new DataView(chunk.buffer).setInt32(0, value, true);\n return this.raw(chunk);\n }\n /**\n * Write a `sint32` value, a signed, zigzag-encoded 32-bit varint.\n */\n sint32(value) {\n assertInt32(value);\n // zigzag encode\n value = ((value << 1) ^ (value >> 31)) >>> 0;\n varint32write(value, this.buf);\n return this;\n }\n /**\n * Write a `fixed64` value, a signed, fixed-length 64-bit integer.\n */\n sfixed64(value) {\n let chunk = new Uint8Array(8), view = new DataView(chunk.buffer), tc = protoInt64.enc(value);\n view.setInt32(0, tc.lo, true);\n view.setInt32(4, tc.hi, true);\n return this.raw(chunk);\n }\n /**\n * Write a `fixed64` value, an unsigned, fixed-length 64 bit integer.\n */\n fixed64(value) {\n let chunk = new Uint8Array(8), view = new DataView(chunk.buffer), tc = protoInt64.uEnc(value);\n view.setInt32(0, tc.lo, true);\n view.setInt32(4, tc.hi, true);\n return this.raw(chunk);\n }\n /**\n * Write a `int64` value, a signed 64-bit varint.\n */\n int64(value) {\n let tc = protoInt64.enc(value);\n varint64write(tc.lo, tc.hi, this.buf);\n return this;\n }\n /**\n * Write a `sint64` value, a signed, zig-zag-encoded 64-bit varint.\n */\n sint64(value) {\n let tc = protoInt64.enc(value), \n // zigzag encode\n sign = tc.hi >> 31, lo = (tc.lo << 1) ^ sign, hi = ((tc.hi << 1) | (tc.lo >>> 31)) ^ sign;\n varint64write(lo, hi, this.buf);\n return this;\n }\n /**\n * Write a `uint64` value, an unsigned 64-bit varint.\n */\n uint64(value) {\n let tc = protoInt64.uEnc(value);\n varint64write(tc.lo, tc.hi, this.buf);\n return this;\n }\n}\nexport class BinaryReader {\n constructor(buf, decodeUtf8 = getTextEncoding().decodeUtf8) {\n this.decodeUtf8 = decodeUtf8;\n this.varint64 = varint64read; // dirty cast for `this`\n /**\n * Read a `uint32` field, an unsigned 32 bit varint.\n */\n this.uint32 = varint32read;\n this.buf = buf;\n this.len = buf.length;\n this.pos = 0;\n this.view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n }\n /**\n * Reads a tag - field number and wire type.\n */\n tag() {\n let tag = this.uint32(), fieldNo = tag >>> 3, wireType = tag & 7;\n if (fieldNo <= 0 || wireType < 0 || wireType > 5)\n throw new Error(\"illegal tag: field no \" + fieldNo + \" wire type \" + wireType);\n return [fieldNo, wireType];\n }\n /**\n * Skip one element and return the skipped data.\n *\n * When skipping StartGroup, provide the tags field number to check for\n * matching field number in the EndGroup tag.\n */\n skip(wireType, fieldNo) {\n let start = this.pos;\n switch (wireType) {\n case WireType.Varint:\n while (this.buf[this.pos++] & 0x80) {\n // ignore\n }\n break;\n // eslint-disable-next-line\n // @ts-expect-error TS7029: Fallthrough case in switch\n case WireType.Bit64:\n this.pos += 4;\n // eslint-disable-next-line no-fallthrough\n case WireType.Bit32:\n this.pos += 4;\n break;\n case WireType.LengthDelimited:\n let len = this.uint32();\n this.pos += len;\n break;\n case WireType.StartGroup:\n for (;;) {\n const [fn, wt] = this.tag();\n if (wt === WireType.EndGroup) {\n if (fieldNo !== undefined && fn !== fieldNo) {\n throw new Error(\"invalid end group tag\");\n }\n break;\n }\n this.skip(wt, fn);\n }\n break;\n default:\n throw new Error(\"cant skip wire type \" + wireType);\n }\n this.assertBounds();\n return this.buf.subarray(start, this.pos);\n }\n /**\n * Throws error if position in byte array is out of range.\n */\n assertBounds() {\n if (this.pos > this.len)\n throw new RangeError(\"premature EOF\");\n }\n /**\n * Read a `int32` field, a signed 32 bit varint.\n */\n int32() {\n return this.uint32() | 0;\n }\n /**\n * Read a `sint32` field, a signed, zigzag-encoded 32-bit varint.\n */\n sint32() {\n let zze = this.uint32();\n // decode zigzag\n return (zze >>> 1) ^ -(zze & 1);\n }\n /**\n * Read a `int64` field, a signed 64-bit varint.\n */\n int64() {\n return protoInt64.dec(...this.varint64());\n }\n /**\n * Read a `uint64` field, an unsigned 64-bit varint.\n */\n uint64() {\n return protoInt64.uDec(...this.varint64());\n }\n /**\n * Read a `sint64` field, a signed, zig-zag-encoded 64-bit varint.\n */\n sint64() {\n let [lo, hi] = this.varint64();\n // decode zig zag\n let s = -(lo & 1);\n lo = ((lo >>> 1) | ((hi & 1) << 31)) ^ s;\n hi = (hi >>> 1) ^ s;\n return protoInt64.dec(lo, hi);\n }\n /**\n * Read a `bool` field, a variant.\n */\n bool() {\n let [lo, hi] = this.varint64();\n return lo !== 0 || hi !== 0;\n }\n /**\n * Read a `fixed32` field, an unsigned, fixed-length 32-bit integer.\n */\n fixed32() {\n return this.view.getUint32((this.pos += 4) - 4, true);\n }\n /**\n * Read a `sfixed32` field, a signed, fixed-length 32-bit integer.\n */\n sfixed32() {\n return this.view.getInt32((this.pos += 4) - 4, true);\n }\n /**\n * Read a `fixed64` field, an unsigned, fixed-length 64 bit integer.\n */\n fixed64() {\n return protoInt64.uDec(this.sfixed32(), this.sfixed32());\n }\n /**\n * Read a `fixed64` field, a signed, fixed-length 64-bit integer.\n */\n sfixed64() {\n return protoInt64.dec(this.sfixed32(), this.sfixed32());\n }\n /**\n * Read a `float` field, 32-bit floating point number.\n */\n float() {\n return this.view.getFloat32((this.pos += 4) - 4, true);\n }\n /**\n * Read a `double` field, a 64-bit floating point number.\n */\n double() {\n return this.view.getFloat64((this.pos += 8) - 8, true);\n }\n /**\n * Read a `bytes` field, length-delimited arbitrary data.\n */\n bytes() {\n let len = this.uint32(), start = this.pos;\n this.pos += len;\n this.assertBounds();\n return this.buf.subarray(start, start + len);\n }\n /**\n * Read a `string` field, length-delimited data converted to UTF-8 text.\n */\n string() {\n return this.decodeUtf8(this.bytes());\n }\n}\n/**\n * Assert a valid signed protobuf 32-bit integer as a number or string.\n */\nfunction assertInt32(arg) {\n if (typeof arg == \"string\") {\n arg = Number(arg);\n }\n else if (typeof arg != \"number\") {\n throw new Error(\"invalid int32: \" + typeof arg);\n }\n if (!Number.isInteger(arg) ||\n arg > INT32_MAX ||\n arg < INT32_MIN)\n throw new Error(\"invalid int32: \" + arg);\n}\n/**\n * Assert a valid unsigned protobuf 32-bit integer as a number or string.\n */\nfunction assertUInt32(arg) {\n if (typeof arg == \"string\") {\n arg = Number(arg);\n }\n else if (typeof arg != \"number\") {\n throw new Error(\"invalid uint32: \" + typeof arg);\n }\n if (!Number.isInteger(arg) ||\n arg > UINT32_MAX ||\n arg < 0)\n throw new Error(\"invalid uint32: \" + arg);\n}\n/**\n * Assert a valid protobuf float value as a number or string.\n */\nfunction assertFloat32(arg) {\n if (typeof arg == \"string\") {\n const o = arg;\n arg = Number(arg);\n if (isNaN(arg) && o !== \"NaN\") {\n throw new Error(\"invalid float32: \" + o);\n }\n }\n else if (typeof arg != \"number\") {\n throw new Error(\"invalid float32: \" + typeof arg);\n }\n if (Number.isFinite(arg) &&\n (arg > FLOAT32_MAX || arg < FLOAT32_MIN))\n throw new Error(\"invalid float32: \" + arg);\n}\n","// Code generated by protoc-gen-ts_proto. DO NOT EDIT.\n// versions:\n// protoc-gen-ts_proto v2.6.1\n// protoc v3.19.1\n// source: google/protobuf/timestamp.proto\n\n/* eslint-disable */\nimport { BinaryReader, BinaryWriter } from \"@bufbuild/protobuf/wire\";\n\n/**\n * A Timestamp represents a point in time independent of any time zone or local\n * calendar, encoded as a count of seconds and fractions of seconds at\n * nanosecond resolution. The count is relative to an epoch at UTC midnight on\n * January 1, 1970, in the proleptic Gregorian calendar which extends the\n * Gregorian calendar backwards to year one.\n *\n * All minutes are 60 seconds long. Leap seconds are \"smeared\" so that no leap\n * second table is needed for interpretation, using a [24-hour linear\n * smear](https://developers.google.com/time/smear).\n *\n * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By\n * restricting to that range, we ensure that we can convert to and from [RFC\n * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.\n *\n * # Examples\n *\n * Example 1: Compute Timestamp from POSIX `time()`.\n *\n * Timestamp timestamp;\n * timestamp.set_seconds(time(NULL));\n * timestamp.set_nanos(0);\n *\n * Example 2: Compute Timestamp from POSIX `gettimeofday()`.\n *\n * struct timeval tv;\n * gettimeofday(&tv, NULL);\n *\n * Timestamp timestamp;\n * timestamp.set_seconds(tv.tv_sec);\n * timestamp.set_nanos(tv.tv_usec * 1000);\n *\n * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.\n *\n * FILETIME ft;\n * GetSystemTimeAsFileTime(&ft);\n * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;\n *\n * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z\n * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.\n * Timestamp timestamp;\n * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));\n * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));\n *\n * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.\n *\n * long millis = System.currentTimeMillis();\n *\n * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)\n * .setNanos((int) ((millis % 1000) * 1000000)).build();\n *\n * Example 5: Compute Timestamp from Java `Instant.now()`.\n *\n * Instant now = Instant.now();\n *\n * Timestamp timestamp =\n * Timestamp.newBuilder().setSeconds(now.getEpochSecond())\n * .setNanos(now.getNano()).build();\n *\n * Example 6: Compute Timestamp from current time in Python.\n *\n * timestamp = Timestamp()\n * timestamp.GetCurrentTime()\n *\n * # JSON Mapping\n *\n * In JSON format, the Timestamp type is encoded as a string in the\n * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the\n * format is \"{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z\"\n * where {year} is always expressed using four digits while {month}, {day},\n * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional\n * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),\n * are optional. The \"Z\" suffix indicates the timezone (\"UTC\"); the timezone\n * is required. A proto3 JSON serializer should always use UTC (as indicated by\n * \"Z\") when printing the Timestamp type and a proto3 JSON parser should be\n * able to accept both UTC and other timezones (as indicated by an offset).\n *\n * For example, \"2017-01-15T01:30:15.01Z\" encodes 15.01 seconds past\n * 01:30 UTC on January 15, 2017.\n *\n * In JavaScript, one can convert a Date object to this format using the\n * standard\n * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)\n * method. In Python, a standard `datetime.datetime` object can be converted\n * to this format using\n * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with\n * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use\n * the Joda Time's [`ISODateTimeFormat.dateTime()`](\n * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D\n * ) to obtain a formatter capable of generating timestamps in this format.\n */\nexport interface Timestamp {\n /**\n * Represents seconds of UTC time since Unix epoch\n * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n * 9999-12-31T23:59:59Z inclusive.\n */\n seconds: number;\n /**\n * Non-negative fractions of a second at nanosecond resolution. Negative\n * second values with fractions must still have non-negative nanos values\n * that count forward in time. Must be from 0 to 999,999,999\n * inclusive.\n */\n nanos: number;\n}\n\nfunction createBaseTimestamp(): Timestamp {\n return { seconds: 0, nanos: 0 };\n}\n\nexport const Timestamp: MessageFns<Timestamp> = {\n encode(message: Timestamp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.seconds !== 0) {\n writer.uint32(8).int64(message.seconds);\n }\n if (message.nanos !== 0) {\n writer.uint32(16).int32(message.nanos);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): Timestamp {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n let end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseTimestamp();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 8) {\n break;\n }\n\n message.seconds = longToNumber(reader.int64());\n continue;\n }\n case 2: {\n if (tag !== 16) {\n break;\n }\n\n message.nanos = reader.int32();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n fromJSON(object: any): Timestamp {\n return {\n seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0,\n nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0,\n };\n },\n\n toJSON(message: Timestamp): unknown {\n const obj: any = {};\n if (message.seconds !== 0) {\n obj.seconds = Math.round(message.seconds);\n }\n if (message.nanos !== 0) {\n obj.nanos = Math.round(message.nanos);\n }\n return obj;\n },\n\n create(base?: DeepPartial<Timestamp>): Timestamp {\n return Timestamp.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<Timestamp>): Timestamp {\n const message = createBaseTimestamp();\n message.seconds = object.seconds ?? 0;\n message.nanos = object.nanos ?? 0;\n return message;\n },\n};\n\ntype Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;\n\ntype DeepPartial<T> = T extends Builtin ? T\n : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>\n : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>\n : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }\n : Partial<T>;\n\nfunction longToNumber(int64: { toString(): string }): number {\n const num = globalThis.Number(int64.toString());\n if (num > globalThis.Number.MAX_SAFE_INTEGER) {\n throw new globalThis.Error(\"Value is larger than Number.MAX_SAFE_INTEGER\");\n }\n if (num < globalThis.Number.MIN_SAFE_INTEGER) {\n throw new globalThis.Error(\"Value is smaller than Number.MIN_SAFE_INTEGER\");\n }\n return num;\n}\n\nfunction isSet(value: any): boolean {\n return value !== null && value !== undefined;\n}\n\ninterface MessageFns<T> {\n encode(message: T, writer?: BinaryWriter): BinaryWriter;\n decode(input: BinaryReader | Uint8Array, length?: number): T;\n fromJSON(object: any): T;\n toJSON(message: T): unknown;\n create(base?: DeepPartial<T>): T;\n fromPartial(object: DeepPartial<T>): T;\n}\n","// Code generated by protoc-gen-ts_proto. DO NOT EDIT.\n// versions:\n// protoc-gen-ts_proto v2.6.1\n// protoc v3.19.1\n// source: common.proto\n\n/* eslint-disable */\nimport { BinaryReader, BinaryWriter } from \"@bufbuild/protobuf/wire\";\nimport { Timestamp } from \"./google/protobuf/timestamp\";\n\n/** Тип инструмента. */\nexport enum InstrumentType {\n INSTRUMENT_TYPE_UNSPECIFIED = 0,\n /** INSTRUMENT_TYPE_BOND - Облигация. */\n INSTRUMENT_TYPE_BOND = 1,\n /** INSTRUMENT_TYPE_SHARE - Акция. */\n INSTRUMENT_TYPE_SHARE = 2,\n /** INSTRUMENT_TYPE_CURRENCY - Валюта. */\n INSTRUMENT_TYPE_CURRENCY = 3,\n /** INSTRUMENT_TYPE_ETF - Exchange-traded fund. Фонд. */\n INSTRUMENT_TYPE_ETF = 4,\n /** INSTRUMENT_TYPE_FUTURES - Фьючерс. */\n INSTRUMENT_TYPE_FUTURES = 5,\n /** INSTRUMENT_TYPE_SP - Структурная нота. */\n INSTRUMENT_TYPE_SP = 6,\n /** INSTRUMENT_TYPE_OPTION - Опцион. */\n INSTRUMENT_TYPE_OPTION = 7,\n /** INSTRUMENT_TYPE_CLEARING_CERTIFICATE - Clearing certificate. */\n INSTRUMENT_TYPE_CLEARING_CERTIFICATE = 8,\n /** INSTRUMENT_TYPE_INDEX - Индекс. */\n INSTRUMENT_TYPE_INDEX = 9,\n /** INSTRUMENT_TYPE_COMMODITY - Товар. */\n INSTRUMENT_TYPE_COMMODITY = 10,\n UNRECOGNIZED = -1,\n}\n\nexport function instrumentTypeFromJSON(object: any): InstrumentType {\n switch (object) {\n case 0:\n case \"INSTRUMENT_TYPE_UNSPECIFIED\":\n return InstrumentType.INSTRUMENT_TYPE_UNSPECIFIED;\n case 1:\n case \"INSTRUMENT_TYPE_BOND\":\n return InstrumentType.INSTRUMENT_TYPE_BOND;\n case 2:\n case \"INSTRUMENT_TYPE_SHARE\":\n return InstrumentType.INSTRUMENT_TYPE_SHARE;\n case 3:\n case \"INSTRUMENT_TYPE_CURRENCY\":\n return InstrumentType.INSTRUMENT_TYPE_CURRENCY;\n case 4:\n case \"INSTRUMENT_TYPE_ETF\":\n return InstrumentType.INSTRUMENT_TYPE_ETF;\n case 5:\n case \"INSTRUMENT_TYPE_FUTURES\":\n return InstrumentType.INSTRUMENT_TYPE_FUTURES;\n case 6:\n case \"INSTRUMENT_TYPE_SP\":\n return InstrumentType.INSTRUMENT_TYPE_SP;\n case 7:\n case \"INSTRUMENT_TYPE_OPTION\":\n return InstrumentType.INSTRUMENT_TYPE_OPTION;\n case 8:\n case \"INSTRUMENT_TYPE_CLEARING_CERTIFICATE\":\n return InstrumentType.INSTRUMENT_TYPE_CLEARING_CERTIFICATE;\n case 9:\n case \"INSTRUMENT_TYPE_INDEX\":\n return InstrumentType.INSTRUMENT_TYPE_INDEX;\n case 10:\n case \"INSTRUMENT_TYPE_COMMODITY\":\n return InstrumentType.INSTRUMENT_TYPE_COMMODITY;\n case -1:\n case \"UNRECOGNIZED\":\n default:\n return InstrumentType.UNRECOGNIZED;\n }\n}\n\nexport function instrumentTypeToJSON(object: InstrumentType): string {\n switch (object) {\n case InstrumentType.INSTRUMENT_TYPE_UNSPECIFIED:\n return \"INSTRUMENT_TYPE_UNSPECIFIED\";\n case InstrumentType.INSTRUMENT_TYPE_BOND:\n return \"INSTRUMENT_TYPE_BOND\";\n case InstrumentType.INSTRUMENT_TYPE_SHARE:\n return \"INSTRUMENT_TYPE_SHARE\";\n case InstrumentType.INSTRUMENT_TYPE_CURRENCY:\n return \"INSTRUMENT_TYPE_CURRENCY\";\n case InstrumentType.INSTRUMENT_TYPE_ETF:\n return \"INSTRUMENT_TYPE_ETF\";\n case InstrumentType.INSTRUMENT_TYPE_FUTURES:\n return \"INSTRUMENT_TYPE_FUTURES\";\n case InstrumentType.INSTRUMENT_TYPE_SP:\n return \"INSTRUMENT_TYPE_SP\";\n case InstrumentType.INSTRUMENT_TYPE_OPTION:\n return \"INSTRUMENT_TYPE_OPTION\";\n case InstrumentType.INSTRUMENT_TYPE_CLEARING_CERTIFICATE:\n return \"INSTRUMENT_TYPE_CLEARING_CERTIFICATE\";\n case InstrumentType.INSTRUMENT_TYPE_INDEX:\n return \"INSTRUMENT_TYPE_INDEX\";\n case InstrumentType.INSTRUMENT_TYPE_COMMODITY:\n return \"INSTRUMENT_TYPE_COMMODITY\";\n case InstrumentType.UNRECOGNIZED:\n default:\n return \"UNRECOGNIZED\";\n }\n}\n\n/** Статус запрашиваемых инструментов. */\nexport enum InstrumentStatus {\n /** INSTRUMENT_STATUS_UNSPECIFIED - Значение не определено. */\n INSTRUMENT_STATUS_UNSPECIFIED = 0,\n /** INSTRUMENT_STATUS_BASE - Базовый список инструментов (по умолчанию). Инструменты, доступные для торговли через T-Invest API. Cейчас списки бумаг, которые доступны из API и других интерфейсах совпадают — кроме внебиржевых бумаг. Но в будущем возможны ситуации, когда списки инструментов будут отличаться. */\n INSTRUMENT_STATUS_BASE = 1,\n /** INSTRUMENT_STATUS_ALL - Список всех инструментов. */\n INSTRUMENT_STATUS_ALL = 2,\n UNRECOGNIZED = -1,\n}\n\nexport function instrumentStatusFromJSON(object: any): InstrumentStatus {\n switch (object) {\n case 0:\n case \"INSTRUMENT_STATUS_UNSPECIFIED\":\n return InstrumentStatus.INSTRUMENT_STATUS_UNSPECIFIED;\n case 1:\n case \"INSTRUMENT_STATUS_BASE\":\n return InstrumentStatus.INSTRUMENT_STATUS_BASE;\n case 2:\n case \"INSTRUMENT_STATUS_ALL\":\n return InstrumentStatus.INSTRUMENT_STATUS_ALL;\n case -1:\n case \"UNRECOGNIZED\":\n default:\n return InstrumentStatus.UNRECOGNIZED;\n }\n}\n\nexport function instrumentStatusToJSON(object: InstrumentStatus): string {\n switch (object) {\n case InstrumentStatus.INSTRUMENT_STATUS_UNSPECIFIED:\n return \"INSTRUMENT_STATUS_UNSPECIFIED\";\n case InstrumentStatus.INSTRUMENT_STATUS_BASE:\n return \"INSTRUMENT_STATUS_BASE\";\n case InstrumentStatus.INSTRUMENT_STATUS_ALL:\n return \"INSTRUMENT_STATUS_ALL\";\n case InstrumentStatus.UNRECOGNIZED:\n default:\n return \"UNRECOGNIZED\";\n }\n}\n\n/** Режим торгов инструмента */\nexport enum SecurityTradingStatus {\n /** SECURITY_TRADING_STATUS_UNSPECIFIED - Торговый статус не определён. */\n SECURITY_TRADING_STATUS_UNSPECIFIED = 0,\n /** SECURITY_TRADING_STATUS_NOT_AVAILABLE_FOR_TRADING - Недоступен для торгов. */\n SECURITY_TRADING_STATUS_NOT_AVAILABLE_FOR_TRADING = 1,\n /** SECURITY_TRADING_STATUS_OPENING_PERIOD - Период открытия торгов. */\n SECURITY_TRADING_STATUS_OPENING_PERIOD = 2,\n /** SECURITY_TRADING_STATUS_CLOSING_PERIOD - Период закрытия торгов. */\n SECURITY_TRADING_STATUS_CLOSING_PERIOD = 3,\n /** SECURITY_TRADING_STATUS_BREAK_IN_TRADING - Перерыв в торговле. */\n SECURITY_TRADING_STATUS_BREAK_IN_TRADING = 4,\n /** SECURITY_TRADING_STATUS_NORMAL_TRADING - Нормальная торговля. */\n SECURITY_TRADING_STATUS_NORMAL_TRADING = 5,\n /** SECURITY_TRADING_STATUS_CLOSING_AUCTION - Аукцион закрытия. */\n SECURITY_TRADING_STATUS_CLOSING_AUCTION = 6,\n /** SECURITY_TRADING_STATUS_DARK_POOL_AUCTION - Аукцион крупных пакетов. */\n SECURITY_TRADING_STATUS_DARK_POOL_AUCTION = 7,\n /** SECURITY_TRADING_STATUS_DISCRETE_AUCTION - Дискретный аукцион. */\n SECURITY_TRADING_STATUS_DISCRETE_AUCTION = 8,\n /** SECURITY_TRADING_STATUS_OPENING_AUCTION_PERIOD - Аукцио