Skip to main content

DEFAULT_LIMITS_TOML

Constant DEFAULT_LIMITS_TOML 

Source
pub const DEFAULT_LIMITS_TOML: &str = "# ALOR Broker API rate limits for brokapi-alor.\n#\n# Source: the article \"\u{41e}\u{433}\u{440}\u{430}\u{43d}\u{438}\u{447}\u{435}\u{43d}\u{438}\u{44f} \u{438} \u{440}\u{435}\u{43a}\u{43e}\u{43c}\u{435}\u{43d}\u{434}\u{430}\u{446}\u{438}\u{438}\" and the page \"HTTP API\" of the ALOR documentation: up to 100\n# HTTP requests a second per user, up to 10 WebSocket connections, up to 5000 subscriptions on a connection, up to\n# 5000 unprocessed messages in the buffer of a connection. The articles give no other numbers.\n#\n# What is NOT published and not verified against a live account: the social rating (the broker counts \"points\" for\n# actions, blocks a login for 2 hours when the limit is reached, and does not say the limit; a request for an order\n# that does not exist costs 100 points and a request that is not valid JSON costs 5000, a WebSocket connection and a\n# subscription cost 1), and on the futures market the counters of errors that the exchange fines. The limiter below\n# only keeps the plain request rate. Whether \"per user\" means per login (all portfolios of it) is read from the\n# article on the rating (\"counters are bound to the login\"), so one limiter should serve every connector of one\n# login, and the daily counters of the broker are not visible to it.\n#\n# One bucket of 100 a second for every HTTP method (the broker does not split them), a smaller soft bucket for\n# placements so that a flood of new orders can never use all of the budget and leave no room for a cancel.\n\n[alor.buckets.http]\n# All HTTP requests of one user: 100 a second.\nrate = 100\nper = \"1s\"\nburst = 100\n\n[alor.buckets.place]\n# Not a limit of the broker: placements (and replacements, stop orders) go through this bucket too, so that they\n# can never use all of the 100 a second. At least 40 a second are left for cancels and reads.\nrate = 60\nper = \"1s\"\nburst = 30\n\n[alor.route]\n# \"*\" = any method with no route below (raw() calls). It spends the plain budget, so a call is never free.\n\"*\" = [\"http\"]\nPlaceOrder = [\"http\", \"place\"]\nReplaceOrder = [\"http\", \"place\"]\nPlaceStopOrder = [\"http\", \"place\"]\nCancelOrder = [\"http\"]\nCancelStopOrder = [\"http\"]\nGetOrder = [\"http\"]\nGetOrders = [\"http\"]\nGetStopOrders = [\"http\"]\nGetTrades = [\"http\"]\nGetPositions = [\"http\"]\nGetSummary = [\"http\"]\nGetOrderBook = [\"http\"]\nGetLastTrades = [\"http\"]\nGetCandles = [\"http\"]\nGetSecurity = [\"http\"]\nGetSecurities = [\"http\"]\nGetTradingStatus = [\"http\"]\nReconcile = [\"http\"]\n\n[alor.conns]\n# The data channel `/ws` carries every subscription of a connector (market data and the user\'s own streams).\nmax_conns = 10\nmax_subs_per_conn = 5000\nsupports_multiplex = true\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.