Skip to main content

DEFAULT_LIMITS_TOML

Constant DEFAULT_LIMITS_TOML 

Source
pub const DEFAULT_LIMITS_TOML: &str = "# BCS Trade API rate limits for brokapi-bcs.\n#\n# Source: the table \"\u{41e}\u{433}\u{440}\u{430}\u{43d}\u{438}\u{447}\u{435}\u{43d}\u{438}\u{44f}\" of the BCS documentation (trade-api-bcs-docs, rest/restrictions): for every\n# service 10 requests per second per client account, except non-trade operations (operation history),\n# 3 per second. The orders service also has a cap of 200000 requests per day. WebSocket: 2 connections for\n# portfolio, limits and marginal indicators, 4 for orders, 20 for market data (100 instruments per connection).\n# An answer 429 means the limit is exceeded.\n#\n# What is NOT verified against a live account: whether the broker counts a second as a fixed window or as a\n# sliding one, whether \"per account\" really means per token, and whether the daily 200000 is a calendar day\n# (Moscow time) or 24 hours. Every service gets its own bucket of 10 per second with a burst of 10 (one\n# second\'s worth, so a short run of calls such as place, status, cancel, list is not held back). Sustained use\n# is held to 10 a second. The daily bucket counts only what this process sends (several processes on one account each have their own count: give the limiter to all\n# connectors of one process, see the Rate limits page of the book).\n\n[bcs.buckets.portfolio]\n# Service \"\u{41f}\u{43e}\u{440}\u{442}\u{444}\u{435}\u{43b}\u{44c}\": 10 RPS\nrate = 10\nper = \"1s\"\nburst = 10\n\n[bcs.buckets.limits]\n# Service \"\u{41b}\u{438}\u{43c}\u{438}\u{442}\u{44b}\": 10 RPS\nrate = 10\nper = \"1s\"\nburst = 10\n\n[bcs.buckets.reference]\n# Service \"\u{421}\u{43f}\u{440}\u{430}\u{432}\u{43e}\u{447}\u{43d}\u{438}\u{43a}\" (instruments, trading status, schedule): 10 RPS\nrate = 10\nper = \"1s\"\nburst = 10\n\n[bcs.buckets.orders]\n# Service \"\u{417}\u{430}\u{44f}\u{432}\u{43a}\u{438}\" (place, change, cancel, the list of orders): 10 RPS\nrate = 10\nper = \"1s\"\nburst = 10\n\n[bcs.buckets.place]\n# Not a limit of the broker: placements (and replacements, stop orders) go through this bucket too, so that\n# they can never use all of the 10 a second of the orders service. At least 2 a second are left for cancels.\nrate = 8\nper = \"1s\"\nburst = 4\n\n[bcs.buckets.orders_daily]\n# The same service, 200000 requests a day. A bucket of 200000 that refills evenly over 24 hours.\nrate = 200000\nper = \"24h\"\nburst = 200000\n\n[bcs.buckets.order_status]\n# \"\u{41f}\u{43e}\u{43b}\u{443}\u{447}\u{435}\u{43d}\u{438}\u{435} \u{441}\u{442}\u{430}\u{442}\u{443}\u{441}\u{430} \u{437}\u{430}\u{44f}\u{432}\u{43a}\u{438}\": 10 RPS, a service of its own in the table\nrate = 10\nper = \"1s\"\nburst = 10\n\n[bcs.buckets.trades]\n# Service \"\u{421}\u{434}\u{435}\u{43b}\u{43a}\u{438}\": 10 RPS\nrate = 10\nper = \"1s\"\nburst = 10\n\n[bcs.buckets.discounts]\n# \"\u{414}\u{438}\u{441}\u{43a}\u{43e}\u{43d}\u{442}\u{44b} \u{43f}\u{43e} \u{438}\u{43d}\u{441}\u{442}\u{440}\u{443}\u{43c}\u{435}\u{43d}\u{442}\u{430}\u{43c}\": 10 RPS\nrate = 10\nper = \"1s\"\nburst = 10\n\n[bcs.buckets.market_data]\n# Service \"\u{420}\u{44b}\u{43d}\u{43e}\u{447}\u{43d}\u{44b}\u{435} \u{434}\u{430}\u{43d}\u{43d}\u{44b}\u{435}\": 10 RPS\nrate = 10\nper = \"1s\"\nburst = 10\n\n[bcs.buckets.non_trade]\n# \"\u{41d}\u{435}\u{442}\u{43e}\u{440}\u{433}\u{43e}\u{432}\u{44b}\u{435} \u{43e}\u{43f}\u{435}\u{440}\u{430}\u{446}\u{438}\u{438}\" (operation history): 3 RPS\nrate = 3\nper = \"1s\"\nburst = 3\n\n[bcs.route]\n# \"*\" = any method with no route below (raw() calls). It goes to the budget of the reference service, so\n# a call made through raw() is never free.\n\"*\" = [\"reference\"]\nPlaceOrder = [\"orders\", \"orders_daily\", \"place\"]\nCancelOrder = [\"orders\", \"orders_daily\"]\nReplaceOrder = [\"orders\", \"orders_daily\", \"place\"]\nPlaceStopOrder = [\"orders\", \"orders_daily\", \"place\"]\nCancelStopOrder = [\"orders\", \"orders_daily\"]\nSearchOrders = [\"orders\", \"orders_daily\"]\nGetOrder = [\"order_status\"]\nGetOrderStatus = [\"order_status\"]\nSearchTrades = [\"trades\"]\nGetPortfolio = [\"portfolio\"]\n# A reconciliation spends the budget of its own call here, the GET per order and the list spend theirs.\nReconcile = [\"order_status\"]\nGetOrderBook = [\"market_data\"]\nSubscribeOrderBook = [\"market_data\"]\nSubscribeQuotes = [\"market_data\"]\nGetQuotes = [\"market_data\"]\nGetCandles = [\"market_data\"]\nGetLastTrades = [\"market_data\"]\nGetOperationHistory = [\"non_trade\"]\nGetLimits = [\"limits\"]\nGetInstrumentsDiscounts = [\"discounts\"]\nGetDailySchedule = [\"reference\"]\nGetTradingStatus = [\"reference\"]\nGetInstrumentsByTickers = [\"reference\"]\nGetInstrumentsByIsins = [\"reference\"]\nGetInstrumentsByType = [\"reference\"]\n\n[bcs.conns]\n# The orders channel allows 4 connections, the other channels allow 2 (portfolio, limits) and 20 (market data).\nmax_conns = 4\nmax_subs_per_conn = 50\nsupports_multiplex = false\n";
Expand description

The text of the bundled limits file limits.toml, compiled into the crate.

Parse it with limits_from_toml_str, or take the result directly from default_limits.