diff --git a/docs/search.js b/docs/search.js
index 9a62cb1..df47feb 100644
--- a/docs/search.js
+++ b/docs/search.js
@@ -1,6 +1,6 @@
window.pdocSearch = (function(){
/** elasticlunr - http://weixsong.github.io * Copyright (C) 2017 Oliver Nightingale * Copyright (C) 2017 Wei Song * MIT Licensed */!function(){function e(e){if(null===e||"object"!=typeof e)return e;var t=e.constructor();for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}var t=function(e){var n=new t.Index;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="0.9.5",lunr=t,t.utils={},t.utils.warn=function(e){return function(t){e.console&&console.warn&&console.warn(t)}}(this),t.utils.toString=function(e){return void 0===e||null===e?"":e.toString()},t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){var e=Array.prototype.slice.call(arguments),t=e.pop(),n=e;if("function"!=typeof t)throw new TypeError("last argument must be a function");n.forEach(function(e){this.hasHandler(e)||(this.events[e]=[]),this.events[e].push(t)},this)},t.EventEmitter.prototype.removeListener=function(e,t){if(this.hasHandler(e)){var n=this.events[e].indexOf(t);-1!==n&&(this.events[e].splice(n,1),0==this.events[e].length&&delete this.events[e])}},t.EventEmitter.prototype.emit=function(e){if(this.hasHandler(e)){var t=Array.prototype.slice.call(arguments,1);this.events[e].forEach(function(e){e.apply(void 0,t)},this)}},t.EventEmitter.prototype.hasHandler=function(e){return e in this.events},t.tokenizer=function(e){if(!arguments.length||null===e||void 0===e)return[];if(Array.isArray(e)){var n=e.filter(function(e){return null===e||void 0===e?!1:!0});n=n.map(function(e){return t.utils.toString(e).toLowerCase()});var i=[];return n.forEach(function(e){var n=e.split(t.tokenizer.seperator);i=i.concat(n)},this),i}return e.toString().trim().toLowerCase().split(t.tokenizer.seperator)},t.tokenizer.defaultSeperator=/[\s\-]+/,t.tokenizer.seperator=t.tokenizer.defaultSeperator,t.tokenizer.setSeperator=function(e){null!==e&&void 0!==e&&"object"==typeof e&&(t.tokenizer.seperator=e)},t.tokenizer.resetSeperator=function(){t.tokenizer.seperator=t.tokenizer.defaultSeperator},t.tokenizer.getSeperator=function(){return t.tokenizer.seperator},t.Pipeline=function(){this._queue=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){n in t.Pipeline.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[n]=e},t.Pipeline.getRegisteredFunction=function(e){return e in t.Pipeline.registeredFunctions!=!0?null:t.Pipeline.registeredFunctions[e]},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(e){var i=t.Pipeline.getRegisteredFunction(e);if(!i)throw new Error("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(e){t.Pipeline.warnIfFunctionNotRegistered(e),this._queue.push(e)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._queue.indexOf(e);if(-1===i)throw new Error("Cannot find existingFn");this._queue.splice(i+1,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._queue.indexOf(e);if(-1===i)throw new Error("Cannot find existingFn");this._queue.splice(i,0,n)},t.Pipeline.prototype.remove=function(e){var t=this._queue.indexOf(e);-1!==t&&this._queue.splice(t,1)},t.Pipeline.prototype.run=function(e){for(var t=[],n=e.length,i=this._queue.length,o=0;n>o;o++){for(var r=e[o],s=0;i>s&&(r=this._queue[s](r,o,e),void 0!==r&&null!==r);s++);void 0!==r&&null!==r&&t.push(r)}return t},t.Pipeline.prototype.reset=function(){this._queue=[]},t.Pipeline.prototype.get=function(){return this._queue},t.Pipeline.prototype.toJSON=function(){return this._queue.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Index=function(){this._fields=[],this._ref="id",this.pipeline=new t.Pipeline,this.documentStore=new t.DocumentStore,this.index={},this.eventEmitter=new t.EventEmitter,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))},t.Index.prototype.on=function(){var e=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,e)},t.Index.prototype.off=function(e,t){return this.eventEmitter.removeListener(e,t)},t.Index.load=function(e){e.version!==t.version&&t.utils.warn("version mismatch: current "+t.version+" importing "+e.version);var n=new this;n._fields=e.fields,n._ref=e.ref,n.documentStore=t.DocumentStore.load(e.documentStore),n.pipeline=t.Pipeline.load(e.pipeline),n.index={};for(var i in e.index)n.index[i]=t.InvertedIndex.load(e.index[i]);return n},t.Index.prototype.addField=function(e){return this._fields.push(e),this.index[e]=new t.InvertedIndex,this},t.Index.prototype.setRef=function(e){return this._ref=e,this},t.Index.prototype.saveDocument=function(e){return this.documentStore=new t.DocumentStore(e),this},t.Index.prototype.addDoc=function(e,n){if(e){var n=void 0===n?!0:n,i=e[this._ref];this.documentStore.addDoc(i,e),this._fields.forEach(function(n){var o=this.pipeline.run(t.tokenizer(e[n]));this.documentStore.addFieldLength(i,n,o.length);var r={};o.forEach(function(e){e in r?r[e]+=1:r[e]=1},this);for(var s in r){var u=r[s];u=Math.sqrt(u),this.index[n].addToken(s,{ref:i,tf:u})}},this),n&&this.eventEmitter.emit("add",e,this)}},t.Index.prototype.removeDocByRef=function(e){if(e&&this.documentStore.isDocStored()!==!1&&this.documentStore.hasDoc(e)){var t=this.documentStore.getDoc(e);this.removeDoc(t,!1)}},t.Index.prototype.removeDoc=function(e,n){if(e){var n=void 0===n?!0:n,i=e[this._ref];this.documentStore.hasDoc(i)&&(this.documentStore.removeDoc(i),this._fields.forEach(function(n){var o=this.pipeline.run(t.tokenizer(e[n]));o.forEach(function(e){this.index[n].removeToken(e,i)},this)},this),n&&this.eventEmitter.emit("remove",e,this))}},t.Index.prototype.updateDoc=function(e,t){var t=void 0===t?!0:t;this.removeDocByRef(e[this._ref],!1),this.addDoc(e,!1),t&&this.eventEmitter.emit("update",e,this)},t.Index.prototype.idf=function(e,t){var n="@"+t+"/"+e;if(Object.prototype.hasOwnProperty.call(this._idfCache,n))return this._idfCache[n];var i=this.index[t].getDocFreq(e),o=1+Math.log(this.documentStore.length/(i+1));return this._idfCache[n]=o,o},t.Index.prototype.getFields=function(){return this._fields.slice()},t.Index.prototype.search=function(e,n){if(!e)return[];e="string"==typeof e?{any:e}:JSON.parse(JSON.stringify(e));var i=null;null!=n&&(i=JSON.stringify(n));for(var o=new t.Configuration(i,this.getFields()).get(),r={},s=Object.keys(e),u=0;u
TKSBrokerAPI is the trading platform for automation and simplifying the implementation of trading scenarios,\nas well as working with Tinkoff Invest API server via the REST protocol. The TKSBrokerAPI platform may be used in two ways:\nfrom the console, it has a rich keys and commands, or you can use it as Python module with python import
.
TKSBrokerAPI allows you to automate routine trading operations and implement your trading scenarios, or just receive\nthe necessary information from the broker. It is easy enough to integrate into various CI/CD automation systems.
\n\nThis class implements methods to work with Tinkoff broker server.
\n\nExamples to work with API: https://tinkoff.github.io/investAPI/swagger-ui/
\n\nAbout token
: https://tinkoff.github.io/investAPI/token/
Main class init.
\n\nTKS_API_TOKEN
.TKS_ACCOUNT_ID
.iList
.\nTrue by default. Cache is auto-update if new day has come.\nIf you don't want to use cache and always updates raw data then set useCache=False
.dump.json
by default.Current TKSBrokerAPI version: major.minor, but the build number define at the build-server only.
\n\nLatest version: https://pypi.org/project/tksbrokerapi/
\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.aliases", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.aliases", "kind": "variable", "doc": "Some aliases instead official tickers.
\n\nSee also: TKSEnums.TKS_TICKER_ALIASES
Depth of Market (DOM) can be >= 1. Default: 1. It used with --price
key to showing DOM with current prices for givens ticker or FIGI.
See also: GetCurrentPrices()
.
Tinkoff REST API server for real trade operations. Default: https://invest-public-api.tinkoff.ru/rest
\n\nSee also: API method https://tinkoff.github.io/investAPI/#tinkoff-invest-api_1 and SendAPIRequest()
.
Server operations timeout in seconds. Default: 15
.
See also: SendAPIRequest()
.
Headers which send in every request to broker server. Please, do not change it! Default: {\"Content-Type\": \"application/json\", \"accept\": \"application/json\", \"Authorization\": \"Bearer {your_token}\"}
.
See also: SendAPIRequest()
.
Request body which send to broker server. Default: None
.
See also: SendAPIRequest()
.
Enables more debug information in this class, such as net request and response headers in all methods. False
by default.
If True
then TKSBrokerAPI generate also HTML reports from Markdown. False
by default.
See also: Mako Templates for Python (https://www.makotemplates.org/). Mako is a template library provides simple syntax and maximum performance.
\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.historyFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.historyFile", "kind": "variable", "doc": "Full path to the output file where history candles will be saved or updated. Default: None
, it mean that returns only Pandas DataFrame.
See also: History()
.
Full path to the html file where rendered candles chart stored. Default: index.html
.
See also: ShowHistoryChart()
.
Filename where full available to user instruments list will be saved. Default: instruments.md
.
See also: ShowInstrumentsInfo()
.
Filename with all found instruments searched by part of its ticker, FIGI or name. Default: search-results.md
.
See also: SearchInstruments()
.
Filename where prices of selected instruments will be saved. Default: prices.md
.
See also: GetListOfPrices()
.
Filename where prices of selected instruments will be saved. Default: prices.md
.
See also: ShowInstrumentsInfo()
, RequestBondCoupons()
and RequestTradingStatus()
.
Filename where wider Pandas DataFrame with more information about bonds: main info, current prices, \nbonds payment calendar, some statistics will be stored. Default: ext-bonds.xlsx
.
See also: ExtendBondsData()
.
Filename where bonds payment calendar will be saved. Default: calendar.md
.
Pandas dataframe with only bonds payment calendar also will be stored to default file calendar.xlsx
.
See also: CreateBondsCalendar()
, ShowBondsCalendar()
, ShowInstrumentInfo()
, RequestBondCoupons()
and ExtendBondsData()
.
Filename where current portfolio, open trades and orders will be saved. Default: overview.md
.
See also: Overview()
, RequestPortfolio()
, RequestPositions()
, RequestPendingOrders()
and RequestStopOrders()
.
Filename where short digest of the portfolio status will be saved. Default: overview-digest.md
.
See also: Overview()
with parameter details=\"digest\"
.
Filename where only open positions, without everything else will be saved. Default: overview-positions.md
.
See also: Overview()
with parameter details=\"positions\"
.
Filename where open limits and stop orders will be saved. Default: overview-orders.md
.
See also: Overview()
with parameter details=\"orders\"
.
Filename where only the analytics section and the distribution of the portfolio by various categories will be saved. Default: overview-analytics.md
.
See also: Overview()
with parameter details=\"analytics\"
.
Filename where only the bonds calendar section will be saved. Default: overview-calendar.md
.
See also: Overview()
with parameter details=\"calendar\"
.
Filename where history of deals and trade statistics will be saved. Default: deals.md
.
See also: Deals()
.
Filename where table of funds available for withdrawal will be saved. Default: limits.md
.
See also: OverviewLimits()
and RequestLimits()
.
Filename where all available user's data (accountId
s, common user information, margin status and tariff connections limit) will be saved. Default: user-info.md
.
See also: OverviewUserInfo()
, RequestAccounts()
, RequestUserInfo()
, RequestMarginStatus()
and RequestTariffLimits()
.
Filename where simple table with all available user accounts (accountId
s) will be saved. Default: accounts.md
.
See also: OverviewAccounts()
, RequestAccounts()
.
Filename where raw data about shares, currencies, bonds, etfs and futures will be stored. Default: dump.json
.
Pandas dataframe with raw instruments data also will be stored to default file dump.xlsx
.
See also: DumpInstruments()
and DumpInstrumentsAsXLSX()
.
Dictionary with raw data about shares, currencies, bonds, etfs and futures from broker server. Auto-updating and saving dump to the iListDumpFile
.
See also: Listing()
, DumpInstruments()
.
PriceGenerator object to work with candles data: load, render interact and non-interact charts and so on.
\n\nSee also: LoadHistory()
, ShowHistoryChart()
and the PriceGenerator project: https://github.com/Tim55667757/PriceGenerator
Setter for string with ticker, e.g. GOOGL
. Tickers may be upper case only.
Use alias for USD000UTSTOM
simple as USD
, EUR_RUB__TOM
as EUR
etc.\nMore tickers aliases here: TKSEnums.TKS_TICKER_ALIASES
.
See also: SearchByTicker()
, SearchInstruments()
.
Setter for string with FIGI, e.g. ticker GOOGL
has FIGI BBG009S39JX6
. FIGIs may be upper case only.
See also: SearchByFIGI()
, SearchInstruments()
.
Send GET or POST request to broker server and receive JSON object.
\n\nself.header: must be defining with dictionary of headers.\nself.body: if define then used as request body. None by default.\nself.timeout: global request timeout, 15 seconds by default.
\n\n\n\n", "signature": "(\tself,\turl: str,\treqType: str = 'GET',\tretry: int = 3,\tpause: int = 5) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.Listing", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.Listing", "kind": "function", "doc": "response JSON (dictionary) from broker.
\n
Gets JSON with raw data about shares, currencies, bonds, etfs and futures from broker server.
\n\n\n\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.DumpInstrumentsAsXLSX", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.DumpInstrumentsAsXLSX", "kind": "function", "doc": "Dictionary with all available broker instruments: currencies, shares, bonds, etfs and futures.
\n
Creates XLSX-formatted dump file with raw data of instruments to further used by data scientists or stock analytics.
\n\nSee also: DumpInstruments()
, Listing()
.
True
then at first updates data with Listing()
method,\notherwise just saves exist iList
as XLSX-file (default: dump.xlsx
) .Receives and returns actual raw data about shares, currencies, bonds, etfs and futures from broker server\nusing Listing()
method. If iListDumpFile
string is not empty then also save information to this file.
See also: DumpInstrumentsAsXLSX()
, Listing()
.
True
then at first updates data with Listing()
method,\notherwise just saves exist iList
as JSON-file (default: dump.json
).\n\n", "signature": "(self, forceUpdate: bool = True) -> str:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.ShowInstrumentInfo", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.ShowInstrumentInfo", "kind": "function", "doc": "serialized JSON formatted
\nstr
with full data of instruments, also saved to the--output
JSON-file.
Show information about one instrument defined by json data and prints it in Markdown format.
\n\nSee also: SearchByTicker()
, SearchByFIGI()
, RequestBondCoupons()
, ExtendBondsData()
, ShowBondsCalendar()
and RequestTradingStatus()
.
iJSON = self.iList[\"Shares\"][self._ticker]
True
then also printing information about instrument and its current price.\n\n", "signature": "(self, iJSON: dict, show: bool = True) -> str:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.SearchByTicker", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.SearchByTicker", "kind": "function", "doc": "multilines text in Markdown format with information about one instrument.
\n
Search and return raw broker's information about instrument by its ticker. Variable ticker
must be defined!
False
then do not request current price of instrument (because this is long operation).False
then do not run ShowInstrumentInfo()
method and do not print info to the console.\n\n", "signature": "(self, requestPrice: bool = False, show: bool = False) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.SearchByFIGI", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.SearchByFIGI", "kind": "function", "doc": "JSON formatted data with information about instrument.
\n
Search and return raw broker's information about instrument by its FIGI. Variable figi
must be defined!
False
then do not request current price of instrument (it's long operation).False
then do not run ShowInstrumentInfo()
method and do not print info to the console.\n\n", "signature": "(self, requestPrice: bool = False, show: bool = False) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.GetCurrentPrices", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.GetCurrentPrices", "kind": "function", "doc": "JSON formatted data with information about instrument.
\n
Get and show Depth of Market with current prices of the instrument as dictionary. Result example with depth
5:\n{\"buy\": [{\"price\": 1243.8, \"quantity\": 193},\n {\"price\": 1244.0, \"quantity\": 168},\n {\"price\": 1244.8, \"quantity\": 5},\n {\"price\": 1245.0, \"quantity\": 61},\n {\"price\": 1245.4, \"quantity\": 60}],\n \"sell\": [{\"price\": 1243.6, \"quantity\": 8},\n {\"price\": 1242.6, \"quantity\": 10},\n {\"price\": 1242.4, \"quantity\": 18},\n {\"price\": 1242.2, \"quantity\": 50},\n {\"price\": 1242.0, \"quantity\": 113}],\n \"limitUp\": 1619.0, \"limitDown\": 903.4, \"lastPrice\": 1243.8, \"closePrice\": 1263.0}
, where parameters mean:
See also: SearchByTicker()
and SearchByFIGI()
.\nREST API for request: https://tinkoff.github.io/investAPI/swagger-ui/#/MarketDataService/MarketDataService_GetOrderBook\nResponse fields: https://tinkoff.github.io/investAPI/marketdata/#getorderbookresponse
True
then print DOM to log and console.\n\n", "signature": "(self, show: bool = True) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.ShowInstrumentsInfo", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.ShowInstrumentsInfo", "kind": "function", "doc": "orders book dict with lists of current buy and sell prices:
\n{\"buy\": [{\"price\": x1, \"quantity\": y1, ...}], \"sell\": [....]}
.\n If an error occurred then returns an empty record:\n{\"buy\": [], \"sell\": [], \"limitUp\": None, \"limitDown\": None, \"lastPrice\": None, \"closePrice\": None}
.
This method get and show information about all available broker instruments for current user account.\nIf instrumentsFile
string is not empty then also save information to this file.
True
then print results to console, if False
\u2014 print only to file.\n\n", "signature": "(self, show: bool = True) -> str:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.SearchInstruments", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.SearchInstruments", "kind": "function", "doc": "multi-lines string with all available broker instruments
\n
This method search and show information about instruments by part of its ticker, FIGI or name.\nIf searchResultsFile
string is not empty then also save information to this file.
True
then print results to console, if False
\u2014 return list of result only.\n\n", "signature": "(self, pattern: str, show: bool = True) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.GetUniqueFIGIs", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.GetUniqueFIGIs", "kind": "function", "doc": "list of dictionaries with all found instruments.
\n
Creating list with unique instrument FIGIs from input list of tickers (priority) or FIGIs.
\n\n\n\n", "signature": "(self, instruments: list[str]) -> list:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.GetListOfPrices", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.GetListOfPrices", "kind": "function", "doc": "list with unique instrument FIGIs only.
\n
This method get, maybe show and return prices of list of instruments. WARNING! This is potential long operation!
\n\nSee limits: https://tinkoff.github.io/investAPI/limits/
\n\nIf pricesFile
string is not empty then also save information to this file.
True
then prints prices to console, if False
\u2014 prints only to file pricesFile
.\n\n", "signature": "(self, instruments: list[str], show: bool = False) -> list[dict]:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.ShowListOfPrices", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.ShowListOfPrices", "kind": "function", "doc": "list of instruments looks like
\n[{some ticker info, \"currentPrice\": {current prices}}, {...}, ...]
.\n One item is dict returned bySearchByTicker()
orSearchByFIGI()
methods.
Show table contains current prices of given instruments.
\n\n[{some ticker info, \"currentPrice\"**: {current prices}}, {...}, ...]
.\nOne item is dict returned by SearchByTicker(requestPrice=True)
or by SearchByFIGI(requestPrice=True)
methods.True
then prints prices to console, if False
\u2014 prints only to file pricesFile
.\n\n", "signature": "(self, iList: list, show: bool = True) -> str:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestTradingStatus", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestTradingStatus", "kind": "function", "doc": "multilines text in Markdown format as a table contains current prices.
\n
Requesting trading status for the instrument defined by figi
variable.
Documentation: https://tinkoff.github.io/investAPI/marketdata/#gettradingstatusrequest
\n\n\n\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestPortfolio", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestPortfolio", "kind": "function", "doc": "dictionary with trading status attributes. Response example:\n
\n{\"figi\": \"TCS00A103X66\", \"tradingStatus\": \"SECURITY_TRADING_STATUS_NOT_AVAILABLE_FOR_TRADING\",\n \"limitOrderAvailableFlag\": false, \"marketOrderAvailableFlag\": false, \"apiTradeAvailableFlag\": true}
Requesting actual user's portfolio for current accountId
.
REST API for user portfolio: https://tinkoff.github.io/investAPI/swagger-ui/#/OperationsService/OperationsService_GetPortfolio
\n\nDocumentation: https://tinkoff.github.io/investAPI/operations/#portfoliorequest
\n\n\n\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestPositions", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestPositions", "kind": "function", "doc": "dictionary with user's portfolio.
\n
Requesting open positions by currencies and instruments for current accountId
.
REST API for open positions: https://tinkoff.github.io/investAPI/swagger-ui/#/OperationsService/OperationsService_GetPositions
\n\nDocumentation: https://tinkoff.github.io/investAPI/operations/#positionsrequest
\n\n\n\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestPendingOrders", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestPendingOrders", "kind": "function", "doc": "dictionary with open positions by instruments.
\n
Requesting current actual pending limit orders for current accountId
.
REST API for pending (market) orders: https://tinkoff.github.io/investAPI/swagger-ui/#/OrdersService/OrdersService_GetOrders
\n\nDocumentation: https://tinkoff.github.io/investAPI/orders/#getordersrequest
\n\n\n\n", "signature": "(self) -> list:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestStopOrders", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestStopOrders", "kind": "function", "doc": "list of dictionaries with pending limit orders.
\n
Requesting current actual stop orders for current accountId
.
REST API for opened stop-orders: https://tinkoff.github.io/investAPI/swagger-ui/#/StopOrdersService/StopOrdersService_GetStopOrders
\n\nDocumentation: https://tinkoff.github.io/investAPI/stoporders/#getstopordersrequest
\n\n\n\n", "signature": "(self) -> list:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.Overview", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.Overview", "kind": "function", "doc": "list of dictionaries with stop orders.
\n
Get portfolio: all open positions, orders and some statistics for current accountId
.\nIf overviewFile
, overviewDigestFile
, overviewPositionsFile
, overviewOrdersFile
, overviewAnalyticsFile
\nand overviewBondsCalendarFile
are defined then also save information to file.
WARNING! It is not recommended to run this method too many times in a loop! The server receives\nmany requests about the state of the portfolio, and then, based on the received data, a large number\nof calculation and statistics are collected.
\n\nFalse
then only dictionary returns, if True
then show more debug information.full
\u2014 shows full available information about portfolio status (by default),positions
\u2014 shows only open positions,orders
\u2014 shows only sections of open limits and stop orders.digest
\u2014 show a short digest of the portfolio status,analytics
\u2014 shows only the analytics section and the distribution of the portfolio by various categories,calendar
\u2014 shows only the bonds calendar section (if these present in portfolio),\n\n", "signature": "(self, show: bool = False, details: str = 'full') -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.Deals", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.Deals", "kind": "function", "doc": "dictionary with client's raw portfolio and some statistics.
\n
Returns history operations between two given dates for current accountId
.\nIf reportFile
string is not empty then also save human-readable report.\nShows some statistical data of closed positions.
TradeRoutines.GetDatesAsString()
method.TradeRoutines.GetDatesAsString()
method.True
then also prints all records to the console.False
then remove information about cancelled operations from the deals report.\n\n", "signature": "(\tself,\tstart: str = None,\tend: str = None,\tshow: bool = False,\tshowCancelled: bool = True) -> tuple[list[dict], dict]:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.History", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.History", "kind": "function", "doc": "original list of dictionaries with history of deals records from API (\"operations\" key):\n https://tinkoff.github.io/investAPI/swagger-ui/#/OperationsService/OperationsService_GetOperations\n and dictionary with custom stats: operations in different currencies, withdrawals, incomes etc.
\n
This method returns last history candles of the current instrument defined by ticker
or figi
(FIGI id).
History returned between two given dates: start
and end
. Minimum requested date in the past is 1970-01-01
.\nWarning! Broker server used ISO UTC time by default.
If historyFile
is not None
then method save history to file, otherwise return only Pandas DataFrame.\nAlso, historyFile
used to update history with onlyMissing
parameter.
See also: LoadHistory()
and ShowHistoryChart()
methods.
TradeRoutines.GetDatesAsString()
method.TradeRoutines.GetDatesAsString()
method.\"1min\"
, \"5min\"
, \"15min\"
,\n\"hour\"
, \"day\"
. Default: \"hour\"
.True
then add only last missing candles, do not request all history length from start
.\nFalse by default. Warning! History appends only from last candle to current time\nwith always update last candle!,
by default.True
then also prints Pandas DataFrame to the console.\n\n", "signature": "(\tself,\tstart: str = None,\tend: str = None,\tinterval: str = 'hour',\tonlyMissing: bool = False,\tcsvSep: str = ',',\tshow: bool = False) -> pandas.core.frame.DataFrame:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.LoadHistory", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.LoadHistory", "kind": "function", "doc": "Pandas DataFrame with prices history. Headers of columns are defined by default:\n
\n[\"date\", \"time\", \"open\", \"high\", \"low\", \"close\", \"volume\"]
.
Load candles history from csv-file and return Pandas DataFrame object.
\n\nSee also: History()
and ShowHistoryChart()
methods.
Render an HTML-file with interact or non-interact candlesticks chart. Candles may be path to the csv-file.
\n\nSelf variable htmlHistoryFile
can be use as html-file name to save interaction or non-interaction chart.\nDefault: index.html
(both for interact and non-interact candlesticks chart).
See also: History()
and LoadHistory()
methods.
permissions denied
to html-file.Universal method to create market order and make deal at the current price for current accountId
. Returns JSON data with response.\nIf tp
or sl
> 0, then in additional will open stop-orders with \"TP\" and \"SL\" flags for stopType
parameter.
See also: Order()
docstring. More simple methods than Trade()
are Buy()
and Sell()
.
targetPrice
in self.Order()
.targetPrice
in self.Order()
.%Y-%m-%d %H:%M:%S
.\n\n", "signature": "(\tself,\toperation: str,\tlots: int = 1,\ttp: float = 0.0,\tsl: float = 0.0,\texpDate: str = 'Undefined') -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.Buy", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.Buy", "kind": "function", "doc": "JSON with response from broker server.
\n
More simple method than Trade()
. Create Buy
market order and make deal at the current price. Returns JSON data with response.\nIf tp
or sl
> 0, then in additional will opens stop-orders with \"TP\" and \"SL\" flags for stopType
parameter.
See also: Order()
and Trade()
docstrings.
%Y-%m-%d %H:%M:%S
.\n\n", "signature": "(\tself,\tlots: int = 1,\ttp: float = 0.0,\tsl: float = 0.0,\texpDate: str = 'Undefined') -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.Sell", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.Sell", "kind": "function", "doc": "JSON with response from broker server.
\n
More simple method than Trade()
. Create Sell
market order and make deal at the current price. Returns JSON data with response.\nIf tp
or sl
> 0, then in additional will open stop-orders with \"TP\" and \"SL\" flags for stopType
parameter.
See also: Order()
and Trade()
docstrings.
%Y-%m-%d %H:%M:%S
.\n\n", "signature": "(\tself,\tlots: int = 1,\ttp: float = 0.0,\tsl: float = 0.0,\texpDate: str = 'Undefined') -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.CloseTrades", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.CloseTrades", "kind": "function", "doc": "JSON with response from broker server.
\n
Close position of given instruments.
\n\nOverview()
method.\nThis avoids unnecessary downloading data from the server.Close all positions of given instruments with defined type.
\n\nOverview()
method.\nThis avoids unnecessary downloading data from the server.Universal method to create market or limit orders with all available parameters for current accountId
.\nSee more simple methods: BuyLimit()
, BuyStop()
, SellLimit()
, SellStop()
.
If orderType is \"Limit\" then create pending limit-order below current price if operation is \"Buy\" and above\ncurrent price if operation is \"Sell\". A limit order has no expiration date, it lasts until the end of the trading day.
\n\nWarning! If you try to create limit-order above current price if \"Buy\" or below current price if \"Sell\"\nthen broker immediately open market order as you can do simple --buy or --sell operations!
\n\nIf orderType is \"Stop\" then creates stop-order with any direction \"Buy\" or \"Sell\".\nWhen current price will go up or down to target price value then broker opens a limit order.\nStop-order is opened with unlimited expiration date by default, or you can define expiration date with expDate parameter.
\n\nOnly one attempt and no retry for opens order. If network issue occurred you can create new request.
\n\n%Y-%m-%d %H:%M:%S
.\nThis date is converting to UTC format for server. This parameter only makes sense for stop-order.\nA limit order has no expiration date, it lasts until the end of the trading day.\n\n", "signature": "(\tself,\toperation: str,\torderType: str,\tlots: int,\ttargetPrice: float,\tlimitPrice: float = 0.0,\tstopType: str = 'Limit',\texpDate: str = 'Undefined') -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.BuyLimit", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.BuyLimit", "kind": "function", "doc": "JSON with response from broker server.
\n
Create pending Buy
limit-order (below current price). You must specify only 2 parameters:\nlots
and target price
to open buy limit-order. If you try to create buy limit-order above current price then\nbroker immediately open Buy
market order, such as if you do simple --buy
operation!\nSee also: Order()
docstring.
\n\n", "signature": "(self, lots: int, targetPrice: float) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.BuyStop", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.BuyStop", "kind": "function", "doc": "JSON with response from broker server.
\n
Create Buy
stop-order. You must specify at least 2 parameters: lots
target price
to open buy stop-order.\nIn additional you can specify 3 parameters for buy stop-order: limit price
>=0, stop type
= Limit|SL|TP,\nexpiration date
= Undefined|%%Y-%%m-%%d %%H:%%M:%%S
. When current price will go up or down to\ntarget price value then broker opens a limit order. See also: Order()
docstring.
%Y-%m-%d %H:%M:%S
.\nThis date is converting to UTC format for server.\n\n", "signature": "(\tself,\tlots: int,\ttargetPrice: float,\tlimitPrice: float = 0.0,\tstopType: str = 'Limit',\texpDate: str = 'Undefined') -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.SellLimit", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.SellLimit", "kind": "function", "doc": "JSON with response from broker server.
\n
Create pending Sell
limit-order (above current price). You must specify only 2 parameters:\nlots
and target price
to open sell limit-order. If you try to create sell limit-order below current price then\nbroker immediately open Sell
market order, such as if you do simple --sell
operation!\nSee also: Order()
docstring.
\n\n", "signature": "(self, lots: int, targetPrice: float) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.SellStop", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.SellStop", "kind": "function", "doc": "JSON with response from broker server.
\n
Create Sell
stop-order. You must specify at least 2 parameters: lots
target price
to open sell stop-order.\nIn additional you can specify 3 parameters for sell stop-order: limit price
>=0, stop type
= Limit|SL|TP,\nexpiration date
= Undefined|%%Y-%%m-%%d %%H:%%M:%%S
. When current price will go up or down to\ntarget price value then broker opens a limit order. See also: Order()
docstring.
%Y-%m-%d %H:%M:%S
.\nThis date is converting to UTC format for server.\n\n", "signature": "(\tself,\tlots: int,\ttargetPrice: float,\tlimitPrice: float = 0.0,\tstopType: str = 'Limit',\texpDate: str = 'Undefined') -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.CloseOrders", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.CloseOrders", "kind": "function", "doc": "JSON with response from broker server.
\n
Cancel order or list of orders by its orderId
or stopOrderId
for current accountId
.
orderId
or stopOrderId
.Gets a list of open pending and stop orders and cancel it all.
\n", "signature": "(self) -> None:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.CloseAll", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.CloseAll", "kind": "function", "doc": "Close all available (not blocked) opened trades and orders.
\n\nAlso, you can select one or more keywords case-insensitive:\norders
, shares
, bonds
, etfs
and futures
from TKS_INSTRUMENTS
enum to specify trades type.
Currency positions you must close manually using buy or sell operations, CloseTrades()
or CloseAllTrades()
methods.
Close all available (not blocked) opened trades and orders for one instrument defined by its ticker.
\n\nThis method searches opened trade and orders of instrument throw all portfolio and then use\nCloseTrades()
and CloseOrders()
methods to close trade and cancel all orders for that instrument.
See also: IsInLimitOrders()
, GetLimitOrderIDs()
, IsInStopOrders()
, GetStopOrderIDs()
, CloseTrades()
and CloseOrders()
.
Close all available (not blocked) opened trades and orders for one instrument defined by its FIGI id.
\n\nThis method searches opened trade and orders of instrument throw all portfolio and then use\nCloseTrades()
and CloseOrders()
methods to close trade and cancel all orders for that instrument.
See also: IsInLimitOrders()
, GetLimitOrderIDs()
, IsInStopOrders()
, GetStopOrderIDs()
, CloseTrades()
and CloseOrders()
.
Parse input dictionary of strings with order parameters and return dictionary with parameters to open all orders.
\n\n{\"lots\": \"L_int,...\", \"prices\": \"P_float,...\"}
where\n\"lots\" key: one or more lot values (integer numbers) to open with every limit-order\n\"prices\" key: one or more prices to open limit-orders\nCounts of values in lots and prices lists must be equals!\n\n", "signature": "(operation, **inputParameters):", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.IsInPortfolio", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.IsInPortfolio", "kind": "function", "doc": "list of dictionaries with all lots and prices to open orders that looks like this
\n[{\"lot\": lots_1, \"price\": price_1}, {...}, ...]
Checks if instrument is in the user's portfolio. Instrument must be defined by ticker
(highly priority) or figi
.
None
, then requests portfolio from Overview()
method.\n\n", "signature": "(self, portfolio: dict = None) -> bool:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.GetInstrumentFromPortfolio", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.GetInstrumentFromPortfolio", "kind": "function", "doc": "\n
True
if portfolio contains open position with given instrument,False
otherwise.
Returns instrument from the user's portfolio if it presents there.\nInstrument must be defined by ticker
(highly priority) or figi
.
None
, then requests portfolio from Overview()
method.\n\n", "signature": "(self, portfolio: dict = None) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.IsInLimitOrders", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.IsInLimitOrders", "kind": "function", "doc": "dict with instrument if portfolio contains open position with this instrument,
\nNone
otherwise.
Checks if instrument is in the limit orders list. Instrument must be defined by ticker
(highly priority) or figi
.
See also: CloseAllByTicker()
and CloseAllByFIGI()
.
None
, then requests portfolio from Overview()
method.\n\n", "signature": "(self, portfolio: dict = None) -> bool:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.GetLimitOrderIDs", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.GetLimitOrderIDs", "kind": "function", "doc": "\n
True
if limit orders list contains some limit orders for the instrument,False
otherwise.
Returns list with all orderID
s of opened pending limit orders for the instrument.\nInstrument must be defined by ticker
(highly priority) or figi
.
See also: CloseAllByTicker()
and CloseAllByFIGI()
.
None
, then requests portfolio from Overview()
method.\n\n", "signature": "(self, portfolio: dict = None) -> list[str]:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.IsInStopOrders", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.IsInStopOrders", "kind": "function", "doc": "list with
\norderID
s of limit orders.
Checks if instrument is in the stop orders list. Instrument must be defined by ticker
(highly priority) or figi
.
See also: CloseAllByTicker()
and CloseAllByFIGI()
.
None
, then requests portfolio from Overview()
method.\n\n", "signature": "(self, portfolio: dict = None) -> bool:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.GetStopOrderIDs", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.GetStopOrderIDs", "kind": "function", "doc": "\n
True
if stop orders list contains some stop orders for the instrument,False
otherwise.
Returns list with all orderID
s of opened stop orders for the instrument.\nInstrument must be defined by ticker
(highly priority) or figi
.
See also: CloseAllByTicker()
and CloseAllByFIGI()
.
None
, then requests portfolio from Overview()
method.\n\n", "signature": "(self, portfolio: dict = None) -> list[str]:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestLimits", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestLimits", "kind": "function", "doc": "list with
\norderID
s of stop orders.
Method for obtaining the available funds for withdrawal for current accountId
.
See also:
\n\nOverviewLimits()
method\n\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.OverviewLimits", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.OverviewLimits", "kind": "function", "doc": "dict with raw data from server that contains free funds for withdrawal. Example of dict:\n
\n{\"money\": [{\"currency\": \"rub\", \"units\": \"100\", \"nano\": 290000000}, {...}], \"blocked\": [...], \"blockedGuarantee\": [...]}
.\n Heremoney
is an array of portfolio currency positions,blocked
is an array of blocked currency\n positions of the portfolio andblockedGuarantee
is locked money under collateral for futures.
Method for parsing and show table with available funds for withdrawal for current accountId
.
See also: RequestLimits()
.
False
then only dictionary returns, if True
then also print withdrawal limits to log.\n\n", "signature": "(self, show: bool = False) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestAccounts", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestAccounts", "kind": "function", "doc": "dict with raw parsed data from server and some calculated statistics about it.
\n
Method for requesting all brokerage accounts (accountId
s) of current user detected by token
.
See also:
\n\nOverviewUserInfo()
method\n\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestUserInfo", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestUserInfo", "kind": "function", "doc": "dict with raw data from server that contains accounts info. Example of dict:\n
\n{\"accounts\": [{\"id\": \"20000xxxxx\", \"type\": \"ACCOUNT_TYPE_TINKOFF\", \"name\": \"TKSBrokerAPI account\",\n \"status\": \"ACCOUNT_STATUS_OPEN\", \"openedDate\": \"2018-05-23T00:00:00Z\",\n \"closedDate\": \"1970-01-01T00:00:00Z\", \"accessLevel\": \"ACCOUNT_ACCESS_LEVEL_FULL_ACCESS\"}, ...]}
.\n IfclosedDate=\"1970-01-01T00:00:00Z\"
it means that account is active now.
Method for requesting common user's information.
\n\nSee also:
\n\nqualified_for_work_with
field mean: https://tinkoff.github.io/investAPI/faq_users/#qualified_for_work_withOverviewUserInfo()
method\n\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestMarginStatus", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestMarginStatus", "kind": "function", "doc": "dict with raw data from server that contains user's information. Example of dict:\n
\n{\"premStatus\": true, \"qualStatus\": false, \"qualifiedForWorkWith\": [\"bond\", \"foreign_shares\", \"leverage\",\n \"russian_shares\", \"structured_income_bonds\"], \"tariff\": \"premium\"}
.
Method for requesting margin calculation for defined account ID.
\n\nSee also:
\n\nOverviewUserInfo()
methodNone
, then used class field accountId
.\n\n", "signature": "(self, accountId: str = None) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestTariffLimits", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestTariffLimits", "kind": "function", "doc": "dict with raw data from server that contains margin calculation. If margin is disabled then returns empty dict.\n Example of responses:\n status code 400:
\n{\"code\": 3, \"message\": \"account margin status is disabled\", \"description\": \"30051\" }
, returns:{}
.\n status code 200:{\"liquidPortfolio\": {\"currency\": \"rub\", \"units\": \"7175\", \"nano\": 560000000},\n \"startingMargin\": {\"currency\": \"rub\", \"units\": \"6311\", \"nano\": 840000000},\n \"minimalMargin\": {\"currency\": \"rub\", \"units\": \"3155\", \"nano\": 920000000},\n \"fundsSufficiencyLevel\": {\"units\": \"1\", \"nano\": 280000000},\n \"amountOfMissingFunds\": {\"currency\": \"rub\", \"units\": \"-863\", \"nano\": -720000000}}
.
Method for requesting limits of current tariff (connections, API methods etc.) of current user detected by token
.
See also:
\n\nOverviewUserInfo()
method\n\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestBondCoupons", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestBondCoupons", "kind": "function", "doc": "dict with raw data from server that contains limits of current tariff. Example of dict:\n
\n{\"unaryLimits\": [{\"limitPerMinute\": 0, \"methods\": [\"methods\", \"methods\"]}, ...],\n \"streamLimits\": [{\"streams\": [\"streams\", \"streams\"], \"limit\": 6}, ...]}
.
Requesting bond payment calendar from official placement date to maturity date. If these dates are unknown\nthen requesting dates \"from\": \"1970-01-01T00:00:00.000Z\"
and \"to\": \"2099-12-31T23:59:59.000Z\"
.\nAll dates are in UTC timezone.
REST API: https://tinkoff.github.io/investAPI/swagger-ui/#/InstrumentsService/InstrumentsService_GetBondCoupons\nDocumentation:
\n\nSee also: ExtendBondsData()
.
iJSON = self.iList[\"Bonds\"][self._ticker]
\nIf raw iJSON is not data of bond then server returns an error [400] with message:\n{\"code\": 3, \"message\": \"instrument type is not bond\", \"description\": \"30048\"}
.\n\n", "signature": "(self, iJSON: dict) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.ExtendBondsData", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.ExtendBondsData", "kind": "function", "doc": "dictionary with bond payment calendar. Response example\n
\n{\"events\": [{\"figi\": \"TCS00A101YV8\", \"couponDate\": \"2023-07-26T00:00:00Z\", \"couponNumber\": \"12\",\n \"fixDate\": \"2023-07-25T00:00:00Z\", \"payOneBond\": {\"currency\": \"rub\", \"units\": \"7\", \"nano\": 170000000},\n \"couponType\": \"COUPON_TYPE_CONSTANT\", \"couponStartDate\": \"2023-04-26T00:00:00Z\",\n \"couponEndDate\": \"2023-07-26T00:00:00Z\", \"couponPeriod\": 91}, {...}, ...]}
Requests jsons with raw bonds data for every ticker or FIGI in instruments list and transform it to the wider\nPandas DataFrame with more information about bonds: main info, current prices, bond payment calendar,\ncoupon yields, current yields and some statistics etc.
\n\nWARNING! This is too long operation if a lot of bonds requested from broker server.
\n\nSee also: ShowInstrumentInfo()
, CreateBondsCalendar()
, ShowBondsCalendar()
, RequestBondCoupons()
.
bondsXLSXFile
, default ext-bonds.xlsx
,\nfor further used by data scientists or stock analytics.\n\n", "signature": "(\tself,\tinstruments: list[str],\txlsx: bool = False) -> pandas.core.frame.DataFrame:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.CreateBondsCalendar", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.CreateBondsCalendar", "kind": "function", "doc": "wider Pandas DataFrame with more full and calculated data about bonds, than raw response from broker.\n In XLSX-file and Pandas DataFrame fields mean:\n - main info about bond: https://tinkoff.github.io/investAPI/instruments/#bond\n - info about coupon: https://tinkoff.github.io/investAPI/instruments/#coupon
\n
Creates bond payments calendar as Pandas DataFrame, and also save it to the XLSX-file, calendar.xlsx
by default.
WARNING! This is too long operation if a lot of bonds requested from broker server.
\n\nSee also: ShowBondsCalendar()
, ExtendBondsData()
.
ExtendBondsData()
method and contains\nextended information about bonds: main info, current prices, bond payment calendar,\ncoupon yields, current yields and some statistics etc.\nIf this parameter is None
then used figi
or ticker
as bond name and then calculate ExtendBondsData()
.calendarFile
+ \".xlsx\"
, calendar.xlsx
by default,\nfor further used by data scientists or stock analytics.\n\n", "signature": "(\tself,\textBonds: pandas.core.frame.DataFrame,\txlsx: bool = False) -> pandas.core.frame.DataFrame:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.ShowBondsCalendar", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.ShowBondsCalendar", "kind": "function", "doc": "Pandas DataFrame with only bond payments calendar data. Fields mean: https://tinkoff.github.io/investAPI/instruments/#coupon
\n
Show bond payments calendar as a table. One row in input bonds
dataframe contains one bond.\nAlso, creates Markdown file with calendar data, calendar.md
by default.
See also: ShowInstrumentInfo()
, RequestBondCoupons()
, CreateBondsCalendar()
and ExtendBondsData()
.
ExtendBondsData()
method and contains\nextended information about bonds: main info, current prices, bond payment calendar,\ncoupon yields, current yields and some statistics etc.\nIf this parameter is None
then used figi
or ticker
as bond name and then calculate ExtendBondsData()
.True
then also printing bonds payment calendar to the console,\notherwise save to file calendarFile
only. False
by default.\n\n", "signature": "(self, extBonds: pandas.core.frame.DataFrame, show: bool = True) -> str:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.OverviewAccounts", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.OverviewAccounts", "kind": "function", "doc": "multilines text in Markdown format with bonds payment calendar as a table.
\n
Method for parsing and show simple table with all available user accounts.
\n\nSee also: RequestAccounts()
and OverviewUserInfo()
methods.
False
then only dictionary with accounts data returns, if True
then also print it to log.\n\n", "signature": "(self, show: bool = False) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.OverviewUserInfo", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.OverviewUserInfo", "kind": "function", "doc": "dict with parsed accounts data received from
\nRequestAccounts()
method. Example of dict:\nview = {\"rawAccounts\": {rawAccounts from RequestAccounts() method...},\n \"stat\": {\"accountId string\": {\"type\": \"Tinkoff brokerage account\", \"name\": \"Test - 1\",\n \"status\": \"Opened and active account\", \"opened\": \"2018-05-23 00:00:00\",\n \"closed\": \"\u2014\", \"access\": \"Full access\" }, ...}}
Method for parsing and show all available user's data (accountId
s, common user information, margin status and tariff connections limit).
See also: OverviewAccounts()
, RequestAccounts()
, RequestUserInfo()
, RequestMarginStatus()
and RequestTariffLimits()
methods.
False
then only dictionary returns, if True
then also print user's data to log.\n\n", "signature": "(self, show: bool = False) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.Args", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "Args", "kind": "class", "doc": "dict with raw parsed data from server and some calculated statistics about it.
\n
If Main()
function is imported as module, then this class used to convert arguments from **kwargs as object.
This function get and parse command line keys.
\n", "signature": "():", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.Main", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "Main", "kind": "function", "doc": "Main function for work with TKSBrokerAPI in the console.
\n\nSee examples:
\n\nModule contains a lot of constants from enums sections of Tinkoff Open API documentation used by TKSBrokerAPI module.
\n\nDate and time string format used by Tinkoff Open API. Default: \"%Y-%m-%dT%H:%M:%SZ\"
.
Extended date and time string format used by Tinkoff Open API. Default: \"%Y-%m-%dT%H:%M:%S.%fZ\"
.
Date string format for some methods. Default: \"%Y-%m-%d\"
.
Human-readable format of date and time string. Default: \"%Y-%m-%d %H:%M:%S\"
.
Type of instrument for trade methods must be only one of supported types, listed in this constant. Default: [\"Currencies\", \"Shares\", \"Bonds\", \"Etfs\", \"Futures\"]
Some aliases instead official tickers for using in CLI. For example, you can use \"USD\"
instead of \"USD000UTSTOM\"
.
Candles interval for requesting history data with Tinkoff API. Current available keys are \"1min\"
, \"5min\"
, \"15min\"
, \"hour\"
, \"day\"
.\nSee more: https://tinkoff.github.io/investAPI/swagger-ui/#/MarketDataService/MarketDataService_GetCandles
Account status, enums: https://tinkoff.github.io/investAPI/users/#accountstatus
\n", "default_value": " = {'ACCOUNT_STATUS_UNSPECIFIED': 'Account status undefined', 'ACCOUNT_STATUS_NEW': 'New, open in progress...', 'ACCOUNT_STATUS_OPEN': 'Opened and active account', 'ACCOUNT_STATUS_CLOSED': 'Closed account'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_ACCOUNT_TYPES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_ACCOUNT_TYPES", "kind": "variable", "doc": "Account type, enums: https://tinkoff.github.io/investAPI/users/#accounttype
\n", "default_value": " = {'ACCOUNT_TYPE_UNSPECIFIED': 'Account type undefined', 'ACCOUNT_TYPE_TINKOFF': 'Tinkoff brokerage account', 'ACCOUNT_TYPE_TINKOFF_IIS': 'IIS account', 'ACCOUNT_TYPE_INVEST_BOX': 'Investment "piggy bank"'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_ACCESS_LEVELS", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_ACCESS_LEVELS", "kind": "variable", "doc": "Access level, enums: https://tinkoff.github.io/investAPI/users/#accesslevel
\n", "default_value": " = {'ACCOUNT_ACCESS_LEVEL_UNSPECIFIED': 'Access level undefined', 'ACCOUNT_ACCESS_LEVEL_FULL_ACCESS': 'Full access', 'ACCOUNT_ACCESS_LEVEL_READ_ONLY': 'Read-only access', 'ACCOUNT_ACCESS_LEVEL_NO_ACCESS': 'No access'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_QUALIFIED_TYPES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_QUALIFIED_TYPES", "kind": "variable", "doc": "Values of qualified_for_work_with
, field: https://tinkoff.github.io/investAPI/faq_users/#qualified_for_work_with
Security Trading Status, enums: https://tinkoff.github.io/investAPI/orders/#securitytradingstatus
\n", "default_value": " = {'SECURITY_TRADING_STATUS_UNSPECIFIED': 'Trading status undefined', 'SECURITY_TRADING_STATUS_NOT_AVAILABLE_FOR_TRADING': 'Not available for trading', 'SECURITY_TRADING_STATUS_OPENING_PERIOD': 'Trade opening period', 'SECURITY_TRADING_STATUS_CLOSING_PERIOD': 'Trade closing period', 'SECURITY_TRADING_STATUS_BREAK_IN_TRADING': 'Break in trading', 'SECURITY_TRADING_STATUS_NORMAL_TRADING': 'Normal trading', 'SECURITY_TRADING_STATUS_CLOSING_AUCTION': 'Closing auction', 'SECURITY_TRADING_STATUS_DARK_POOL_AUCTION': 'Large package auction', 'SECURITY_TRADING_STATUS_DISCRETE_AUCTION': 'Discrete auction', 'SECURITY_TRADING_STATUS_OPENING_AUCTION_PERIOD': 'Opening auction', 'SECURITY_TRADING_STATUS_TRADING_AT_CLOSING_AUCTION_PRICE': 'Trading period at the closing auction price', 'SECURITY_TRADING_STATUS_SESSION_ASSIGNED': 'Session assigned', 'SECURITY_TRADING_STATUS_SESSION_CLOSE': 'Session closed', 'SECURITY_TRADING_STATUS_SESSION_OPEN': 'Session is open', 'SECURITY_TRADING_STATUS_DEALER_NORMAL_TRADING': "Broker's internal liquidity mode trading", 'SECURITY_TRADING_STATUS_DEALER_BREAK_IN_TRADING': "Break in trading in the broker's internal liquidity mode", 'SECURITY_TRADING_STATUS_DEALER_NOT_AVAILABLE_FOR_TRADING': "Broker's internal liquidity mode is not available"}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_OPERATION_TYPES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_OPERATION_TYPES", "kind": "variable", "doc": "Operation type, enums: https://tinkoff.github.io/investAPI/operations/#operationtype
\n", "default_value": " = {'OPERATION_TYPE_UNSPECIFIED': 'The operation type is not defined', 'OPERATION_TYPE_INPUT': 'Deposit on broker account', 'OPERATION_TYPE_BOND_TAX': 'Withholding personal income tax on bond coupons', 'OPERATION_TYPE_OUTPUT_SECURITIES': 'Securities output', 'OPERATION_TYPE_OVERNIGHT': 'Overnight REPO income', 'OPERATION_TYPE_TAX': 'Tax withholding', 'OPERATION_TYPE_BOND_REPAYMENT_FULL': 'Full bond redemption', 'OPERATION_TYPE_SELL_CARD': 'Sell securities from the card', 'OPERATION_TYPE_DIVIDEND_TAX': 'Withholding tax on dividends', 'OPERATION_TYPE_OUTPUT': 'Withdrawals', 'OPERATION_TYPE_BOND_REPAYMENT': 'Bonds partial redemption', 'OPERATION_TYPE_TAX_CORRECTION': 'Tax correction', 'OPERATION_TYPE_SERVICE_FEE': 'Brokerage account maintenance fee deduction', 'OPERATION_TYPE_BENEFIT_TAX': 'Withholding tax for material benefits', 'OPERATION_TYPE_MARGIN_FEE': 'Withholding commission for an uncovered position', 'OPERATION_TYPE_BUY': 'Buy securities', 'OPERATION_TYPE_BUY_CARD': 'Buy securities from a card', 'OPERATION_TYPE_INPUT_SECURITIES': 'Transfer securities from another depository', 'OPERATION_TYPE_SELL_MARGIN': 'Sell (by margin call)', 'OPERATION_TYPE_BROKER_FEE': 'Operation fee deduction', 'OPERATION_TYPE_BUY_MARGIN': 'Buy (by margin call)', 'OPERATION_TYPE_DIVIDEND': 'Dividends income', 'OPERATION_TYPE_SELL': 'Sell securities', 'OPERATION_TYPE_COUPON': 'Coupons income', 'OPERATION_TYPE_SUCCESS_FEE': 'Success fee deduction', 'OPERATION_TYPE_DIVIDEND_TRANSFER': 'Transfer of dividend income', 'OPERATION_TYPE_ACCRUING_VARMARGIN': 'Variation margin crediting', 'OPERATION_TYPE_WRITING_OFF_VARMARGIN': 'Withholding variation margin', 'OPERATION_TYPE_DELIVERY_BUY': 'Buy (futures contract expired)', 'OPERATION_TYPE_DELIVERY_SELL': 'Sell (futures contract expired)', 'OPERATION_TYPE_TRACK_MFEE': 'Autotrack account management fee', 'OPERATION_TYPE_TRACK_PFEE': 'Pay per result on auto follow score', 'OPERATION_TYPE_TAX_PROGRESSIVE': 'Tax withholding at the rate of 15%', 'OPERATION_TYPE_BOND_TAX_PROGRESSIVE': 'Withholding tax on coupons at the rate of 15%', 'OPERATION_TYPE_DIVIDEND_TAX_PROGRESSIVE': 'Withholding tax on dividends at the rate of 15%', 'OPERATION_TYPE_BENEFIT_TAX_PROGRESSIVE': 'Withholding tax for material benefits at the rate of 15%', 'OPERATION_TYPE_TAX_CORRECTION_PROGRESSIVE': 'Tax correction at the rate of 15%', 'OPERATION_TYPE_TAX_REPO_PROGRESSIVE': 'Withholding tax on refunds on REPO transactions at the rate of 15%', 'OPERATION_TYPE_TAX_REPO': 'Tax withholding on REPO trade refunds', 'OPERATION_TYPE_TAX_REPO_HOLD': 'Tax hold on REPO transactions', 'OPERATION_TYPE_TAX_REPO_REFUND': 'Tax refund on REPO transactions', 'OPERATION_TYPE_TAX_REPO_HOLD_PROGRESSIVE': 'Withholding tax on REPO transactions at the rate of 15%', 'OPERATION_TYPE_TAX_REPO_REFUND_PROGRESSIVE': 'Tax refund on REPO transactions at the rate of 15%', 'OPERATION_TYPE_DIV_EXT': 'Payout dividends to the card', 'OPERATION_TYPE_TAX_CORRECTION_COUPON': 'Coupon tax correction'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_OPERATION_STATES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_OPERATION_STATES", "kind": "variable", "doc": "Operation state, enums: https://tinkoff.github.io/investAPI/operations/#operationstate
\n", "default_value": " = {'OPERATION_STATE_UNSPECIFIED': '! Unknown', 'OPERATION_STATE_EXECUTED': '\u221a Executed', 'OPERATION_STATE_CANCELED': '\u00d7 Canceled', 'OPERATION_STATE_PROGRESS': '\u21bb Progress'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_ORDER_DIRECTIONS", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_ORDER_DIRECTIONS", "kind": "variable", "doc": "Order direction, enums: https://tinkoff.github.io/investAPI/orders/#orderdirection
\n", "default_value": " = {'ORDER_DIRECTION_UNSPECIFIED': 'Undefined', 'ORDER_DIRECTION_BUY': '\u2191 Buy', 'ORDER_DIRECTION_SELL': '\u2193 Sell'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_STOP_ORDER_DIRECTIONS", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_STOP_ORDER_DIRECTIONS", "kind": "variable", "doc": "Stop-order direction, enums: https://tinkoff.github.io/investAPI/stoporders/#stoporderdirection
\n", "default_value": " = {'STOP_ORDER_DIRECTION_UNSPECIFIED': 'Undefined', 'STOP_ORDER_DIRECTION_BUY': '\u2191 Buy', 'STOP_ORDER_DIRECTION_SELL': '\u2193 Sell'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_ORDER_TYPES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_ORDER_TYPES", "kind": "variable", "doc": "Order type, enums: https://tinkoff.github.io/investAPI/orders/#ordertype
\n", "default_value": " = {'ORDER_TYPE_UNSPECIFIED': 'Undefined', 'ORDER_TYPE_LIMIT': 'Limit', 'ORDER_TYPE_MARKET': 'Market'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_STOP_ORDER_TYPES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_STOP_ORDER_TYPES", "kind": "variable", "doc": "Stop-order type, enums: https://tinkoff.github.io/investAPI/stoporders/#stopordertype
\n", "default_value": " = {'STOP_ORDER_TYPE_UNSPECIFIED': 'Undefined', 'STOP_ORDER_TYPE_TAKE_PROFIT': 'Take profit', 'STOP_ORDER_TYPE_STOP_LOSS': 'Stop loss', 'STOP_ORDER_TYPE_STOP_LIMIT': 'Stop limit'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_ORDER_STATES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_ORDER_STATES", "kind": "variable", "doc": "Order status, enums: https://tinkoff.github.io/investAPI/orders/#orderexecutionreportstatus
\n", "default_value": " = {'EXECUTION_REPORT_STATUS_UNSPECIFIED': '! Unknown', 'EXECUTION_REPORT_STATUS_FILL': 'Performed', 'EXECUTION_REPORT_STATUS_REJECTED': 'Rejected', 'EXECUTION_REPORT_STATUS_CANCELLED': 'Cancelled', 'EXECUTION_REPORT_STATUS_NEW': 'New order', 'EXECUTION_REPORT_STATUS_PARTIALLYFILL': 'Partially filled'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_STOP_ORDER_EXPIRATION_TYPES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_STOP_ORDER_EXPIRATION_TYPES", "kind": "variable", "doc": "Expiration type of stop-orders, enums: https://tinkoff.github.io/investAPI/stoporders/#stoporderexpirationtype
\n", "default_value": " = {'STOP_ORDER_EXPIRATION_TYPE_UNSPECIFIED': 'Undefined', 'STOP_ORDER_EXPIRATION_TYPE_GOOD_TILL_CANCEL': 'Until cancel', 'STOP_ORDER_EXPIRATION_TYPE_GOOD_TILL_DATE': 'Until date'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_COUPON_TYPES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_COUPON_TYPES", "kind": "variable", "doc": "Coupon type of bonds, enums: https://tinkoff.github.io/investAPI/instruments/#coupontype
\n", "default_value": " = {'COUPON_TYPE_UNSPECIFIED': 'Undefined', 'COUPON_TYPE_CONSTANT': 'Constant', 'COUPON_TYPE_FLOATING': 'Floating', 'COUPON_TYPE_DISCOUNT': 'Discount', 'COUPON_TYPE_MORTGAGE': 'Mortgage', 'COUPON_TYPE_FIX': 'Fixed', 'COUPON_TYPE_VARIABLE': 'Variable', 'COUPON_TYPE_OTHER': 'Other'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_REAL_EXCHANGES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_REAL_EXCHANGES", "kind": "variable", "doc": "The real exchange for the execution of trades, enums: https://tinkoff.github.io/investAPI/instruments/#realexchange
\n", "default_value": " = {'REAL_EXCHANGE_UNSPECIFIED': 'Undefined', 'REAL_EXCHANGE_MOEX': 'MOEX', 'REAL_EXCHANGE_RTS': 'SPBEX', 'REAL_EXCHANGE_OTC': 'OTC'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_SHARE_TYPES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_SHARE_TYPES", "kind": "variable", "doc": "Share type, enums: https://tinkoff.github.io/investAPI/instruments/#sharetype
\n", "default_value": " = {'SHARE_TYPE_UNSPECIFIED': 'Undefined', 'SHARE_TYPE_COMMON': 'Ordinary', 'SHARE_TYPE_PREFERRED': 'Privileged', 'SHARE_TYPE_ADR': 'American Depositary Receipts (ADR)', 'SHARE_TYPE_GDR': 'Global Depositary Receipts (GDR)', 'SHARE_TYPE_MLP': 'Master Limited Partnership (MLP)', 'SHARE_TYPE_NY_REG_SHRS': 'New York registered shares', 'SHARE_TYPE_CLOSED_END_FUND': 'Closed investment fund', 'SHARE_TYPE_REIT': 'Real estate trust'}"}, {"fullname": "tksbrokerapi.Templates", "modulename": "tksbrokerapi.Templates", "kind": "module", "doc": "Module contains some html-templates used by reporting methods in TKSBrokerAPI module.
\n\nThis HTML-template used for translating all Markdown-reports to HTML.
\n", "default_value": " = '<!DOCTYPE html>\\n<html lang="en">\\n<html>\\n<head>\\n <meta charset="utf-8"/>\\n <title>${mainTitle}</title>\\n <link rel="stylesheet" type="text/css" href="X:\\\\work\\\\projects\\\\FuzzyMarketAnalytics\\\\public\\\\style.css">\\n <style>${commonCSS}\\n </style>\\n</head>\\n <body>\\n <a href="https://github.com/Tim55667757/TKSBrokerAPI/" target="_blank" rel="noopener noreferrer"><img class="logo" src="https://github.com/Tim55667757/TKSBrokerAPI/blob/develop/docs/media/TKSBrokerAPI-Logo-mini.png?raw=true" alt="TKSBrokerAPI-Logo"></a>\\n <div id="content"></div>\\n <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>\\n <script>\\n var markdown = `${markdown}`; \\n document.getElementById("content").innerHTML = marked.parse(markdown);\\n </script>\\n <div id="footer" class="footer-div">\\n <a href="https://github.com/Tim55667757/TKSBrokerAPI/" target="_blank" rel="noopener noreferrer"><img class="logo2" src="https://github.com/Tim55667757/TKSBrokerAPI/blob/develop/docs/media/TKSBrokerAPI-Logo-text.png?raw=true" alt="TKSBrokerAPI Trade Automation Platform"></a>\\n <div style="display: flex; float: right; justify-content: space-between; padding: 12px 10px 2px 0; margin: 0;"><b>Report generated by <a href="https://github.com/Tim55667757/TKSBrokerAPI/blob/master/README_EN.md" target="_blank" rel="noopener noreferrer">TKSBrokerAPI</a></b></div>\\n </div>\\n </body>\\n</html>'"}, {"fullname": "tksbrokerapi.Templates.COMMON_CSS", "modulename": "tksbrokerapi.Templates", "qualname": "COMMON_CSS", "kind": "variable", "doc": "Common CSS used by all templates.
\n", "default_value": " = '\\n body {\\n background-image: url("data:image/svg+xml;utf8,<svg xmlns=\\'http://www.w3.org/2000/svg\\' version=\\'1.1\\' height=\\'100px\\' width=\\'150px\\'><text transform=\\'translate(20, 100) rotate(-45)\\' fill=\\'rgb(176,176,176)\\' font-size=\\'20\\' opacity=\\'0.25\\'>TKSBrokerAPI</text></svg>");\\n }\\n\\n .logo {\\n width: 120px;\\n float: right;\\n opacity: 0.5;\\n filter: alpha(opacity=40);\\n border-radius: 55px 55px 55px 55px;\\n margin: 0 0 12px 0;\\n }\\n\\n .logo:hover {\\n opacity: 1.0;\\n filter: alpha(opacity=100);\\n }\\n\\n .logo2 {\\n height: 40px;\\n float: left;\\n opacity: 1.0;\\n filter: alpha(opacity=100);\\n border-radius: 25px 25px 25px 25px;\\n padding: 0;\\n margin: 0;\\n }\\n\\n .footer-div {\\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\\n font-size: 12px;\\n color: #333333;\\n background: #E6E6E6;\\n margin: 24px 0 24px 0;\\n border-radius: 20px 20px 20px 20px;\\n padding: 2px 2px 2px 10px;\\n height: 40px;\\n }\\n\\n p {\\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\\n font-size: 13px;\\n padding: 2px;\\n margin: 0;\\n }\\n \\n li {\\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\\n font-size: 13px;\\n padding: 1px 10px;\\n }\\n \\n mark {\\n background: #FFFFE6;\\n padding: 0 3px;\\n }\\n \\n h1 {\\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\\n font-size: 22px;\\n color: #333333;\\n margin: 24px 0 12px 0;\\n }\\n \\n h2 {\\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\\n font-size: 20px;\\n color: #333333;\\n margin: 20px 0 10px 22px;\\n }\\n \\n h3 {\\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\\n font-size: 18px;\\n color: #333333;\\n margin: 16px 0 8px 52px;\\n }\\n \\n details {\\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\\n font-size: 13px;\\n padding: 2px 0;\\n width: 100%;\\n border-radius: 10px 10px 10px 10px;\\n color: #333333;\\n }\\n \\n summary {\\n width: 100%;\\n border-radius: 10px 10px 10px 10px;\\n background: #CCCCCC;\\n height: 20px;\\n display: block;\\n color: #333333;\\n cursor: pointer;\\n }\\n \\n summary::marker {\\n display: none;\\n }\\n \\n summary::before {\\n content: "\\x11B7";\\n padding-right: 0.5em;\\n }\\n \\n details[open] > summary::before {\\n content: "\\x02B8D";\\n }\\n \\n .expand {\\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\\n font-size: 13px;\\n border: none;\\n }\\n \\n .expand::-ms-expand {\\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\\n font-size: 13px;\\n border-radius: 10px;\\n }\\n \\n table {\\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\\n font-size: 13px;\\n width: 100%;\\n border-radius: 40px 40px 10px 10px;\\n border-spacing: 0;\\n text-align: left;\\n background: #FFFFFF;\\n color: #333333;\\n }\\n \\n td {\\n border-style: solid;\\n border-width: 0 1px 1px 0;\\n border-color: white;\\n padding: 12px;\\n vertical-align: top;\\n background: #E6E6E6;\\n }\\n \\n th {\\n border-style: solid;\\n border-width: 0 1px 1px 0;\\n border-color: white;\\n font-size: 14px;\\n vertical-align: top;\\n background: #BFBFBF;\\n text-align: center;\\n }\\n \\n th:first-child {\\n background: #BFBFBF;\\n border-radius: 40px 0 0 0;\\n }\\n \\n th:last-child {\\n background: #BFBFBF;\\n border-radius: 0 40px 0 0;\\n }\\n\\n tr:first-child td:first-child {\\n border-style: solid;\\n border-width: 0 1px 1px 0;\\n border-color: white;\\n padding: 12px;\\n vertical-align: top;\\n background: #E6E6E6;\\n border-radius: 0 0 0 0;\\n }\\n\\n tr:first-child td:last-child {\\n border-style: solid;\\n border-width: 0 1px 1px 0;\\n border-color: white;\\n padding: 12px;\\n vertical-align: top;\\n background: #E6E6E6;\\n border-radius: 0 0 0 0;\\n }\\n\\n tr:last-child td:first-child {\\n background: #E6E6E6;\\n border-radius: 0 0 0 20px;\\n }\\n\\n tr:last-child td:last-child {\\n background: #E6E6E6;\\n border-radius: 0 0 20px 0;\\n }'"}, {"fullname": "tksbrokerapi.TradeRoutines", "modulename": "tksbrokerapi.TradeRoutines", "kind": "module", "doc": "This library contains some methods used by trade scenarios implemented with TKSBrokerAPI module.
\n\nCreate tuple of date and time strings with timezone parsed from user-friendly date.
\n\nWarning! All dates must be in UTC time zone!
\n\nUser dates format must be like: \"%Y-%m-%d\"
, e.g. \"2020-02-03\"
(3 Feb, 2020).
Output date is UTC ISO time format by default: \"%Y-%m-%dT%H:%M:%SZ\"
.
Example input: start=\"2022-06-01\", end=\"2022-06-20\"
-> output: (\"2022-06-01T00:00:00Z\", \"2022-06-20T23:59:59Z\")
.\nAn error exception will occur if input date has incorrect format.
If start=None
, end=None
then return dates from yesterday to the end of the day.
If start=some_date_1
, end=None
then return dates from some_date_1
to the end of the day.
If start=some_date_1
, end=some_date_2
then return dates from start of some_date_1
to end of some_date_2
.
Start day may be negative integer numbers: -1
, -2
, -3
\u2014 how many days ago.
Also, you can use keywords for start if end=None
:
today
(from 00:00:00 to the end of current day),yesterday
(-1 day from 00:00:00 to 23:59:59),week
(-7 day from 00:00:00 to the end of current day),month
(-30 day from 00:00:00 to the end of current day),year
(-365 day from 00:00:00 to the end of current day),userFormat
or keyword.userFormat
.\"%Y-%m-%d\"
.\n\n", "signature": "(\tstart: str = None,\tend: str = None,\tuserFormat: str = '%Y-%m-%d',\toutputFormat: str = '%Y-%m-%dT%H:%M:%SZ') -> tuple[str, str]:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TradeRoutines.NanoToFloat", "modulename": "tksbrokerapi.TradeRoutines", "qualname": "NanoToFloat", "kind": "function", "doc": "tuple with 2 strings
\n(\"start\", \"end\")
. Example of return is(\"2022-06-01T00:00:00Z\", \"2022-06-20T23:59:59Z\")
.\n Second string is the end of the last day.
Convert number in nano-view mode with string parameter units
and integer parameter nano
to float view. Examples:
NanoToFloat(units=\"2\", nano=500000000) -> 2.5
NanoToFloat(units=\"0\", nano=50000000) -> 0.05
\n\n", "signature": "(units: str, nano: int) -> float:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TradeRoutines.FloatToNano", "modulename": "tksbrokerapi.TradeRoutines", "qualname": "FloatToNano", "kind": "function", "doc": "float view of number
\n
Convert float number to nano-type view: dictionary with string units
and integer nano
parameters {\"units\": \"string\", \"nano\": integer}
. Examples:
FloatToNano(number=2.5) -> {\"units\": \"2\", \"nano\": 500000000}
FloatToNano(number=0.05) -> {\"units\": \"0\", \"nano\": 50000000}
\n\n", "signature": "(number: float) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TradeRoutines.UpdateClassFields", "modulename": "tksbrokerapi.TradeRoutines", "qualname": "UpdateClassFields", "kind": "function", "doc": "nano-type view of number:
\n{\"units\": \"string\", \"nano\": integer}
This method get config as dictionary (preloaded from YAML file) and apply key: value
as names of class fields and\nvalues of class fields. Example for class TradeScenario
:\nconfig[\"tickers\"] = [\"TICKER1\", \"TICKER2\"] ==> TradeScenario(TinkoffBrokerServer).tickers = [\"TICKER1\", \"TICKER2\"]
.
key**: value
format.This module init standard python logging system with some of pre-defined parameters,\ne.g. debug level for log-file, info level for console, log-rotate and so on.
\n\nCurrent internal logger name for TKSBrokerAPI module is TKSBrokerAPI-UniLogger
.
This procedure setting up UniLogger verbosity level.
\n", "signature": "(vLevel='ERROR'):", "funcdef": "def"}, {"fullname": "tksbrokerapi.UniLogger.LevelFilter", "modulename": "tksbrokerapi.UniLogger", "qualname": "LevelFilter", "kind": "class", "doc": "Class using to set up log level filtering.
\n", "bases": "logging.Filter"}, {"fullname": "tksbrokerapi.UniLogger.LevelFilter.__init__", "modulename": "tksbrokerapi.UniLogger", "qualname": "LevelFilter.__init__", "kind": "function", "doc": "Initialize a filter.
\n\nInitialize with the name of the logger which, together with its\nchildren, will have its events allowed through the filter. If no\nname is specified, allow every event.
\n", "signature": "(level)"}, {"fullname": "tksbrokerapi.UniLogger.LevelFilter.filter", "modulename": "tksbrokerapi.UniLogger", "qualname": "LevelFilter.filter", "kind": "function", "doc": "Determine if the specified record is to be logged.
\n\nReturns True if the record should be logged, or False otherwise.\nIf deemed appropriate, the record may be modified in-place.
\n", "signature": "(self, record):", "funcdef": "def"}, {"fullname": "tksbrokerapi.UniLogger.EnableLogger", "modulename": "tksbrokerapi.UniLogger", "qualname": "EnableLogger", "kind": "function", "doc": "Adding new file logger with rotation.
\n", "signature": "(\tlogFile,\tparentHandler=<Logger TKSBrokerAPI-UniLogger (DEBUG)>,\tuseFormat=<logging.Formatter object>):", "funcdef": "def"}, {"fullname": "tksbrokerapi.UniLogger.DisableLogger", "modulename": "tksbrokerapi.UniLogger", "qualname": "DisableLogger", "kind": "function", "doc": "Disable given file logger.
\n", "signature": "(handler, parentHandler=<Logger TKSBrokerAPI-UniLogger (DEBUG)>):", "funcdef": "def"}]; + /** pdoc search index */const docs = [{"fullname": "tksbrokerapi", "modulename": "tksbrokerapi", "kind": "module", "doc": "\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI", "modulename": "tksbrokerapi.TKSBrokerAPI", "kind": "module", "doc": "TKSBrokerAPI is the trading platform for automation and simplifying the implementation of trading scenarios,\nas well as working with Tinkoff Invest API server via the REST protocol. The TKSBrokerAPI platform may be used in two ways:\nfrom the console, it has a rich keys and commands, or you can use it as Python module with python import
.
TKSBrokerAPI allows you to automate routine trading operations and implement your trading scenarios, or just receive\nthe necessary information from the broker. It is easy enough to integrate into various CI/CD automation systems.
\n\nThis class implements methods to work with Tinkoff broker server.
\n\nExamples to work with API: https://tinkoff.github.io/investAPI/swagger-ui/
\n\nAbout token
: https://tinkoff.github.io/investAPI/token/
Main class init.
\n\nTKS_API_TOKEN
.TKS_ACCOUNT_ID
.iList
.\nTrue by default. Cache is auto-update if new day has come.\nIf you don't want to use cache and always updates raw data then set useCache=False
.dump.json
by default.Current TKSBrokerAPI version: major.minor, but the build number define at the build-server only.
\n\nLatest version: https://pypi.org/project/tksbrokerapi/
\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.aliases", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.aliases", "kind": "variable", "doc": "Some aliases instead official tickers.
\n\nSee also: TKSEnums.TKS_TICKER_ALIASES
Depth of Market (DOM) can be >= 1. Default: 1. It used with --price
key to showing DOM with current prices for givens ticker or FIGI.
See also: GetCurrentPrices()
.
Tinkoff REST API server for real trade operations. Default: https://invest-public-api.tinkoff.ru/rest
\n\nSee also: API method https://tinkoff.github.io/investAPI/#tinkoff-invest-api_1 and SendAPIRequest()
.
Server operations timeout in seconds. Default: 15
.
See also: SendAPIRequest()
.
Headers which send in every request to broker server. Please, do not change it! Default: {\"Content-Type\": \"application/json\", \"accept\": \"application/json\", \"Authorization\": \"Bearer {your_token}\"}
.
See also: SendAPIRequest()
.
Request body which send to broker server. Default: None
.
See also: SendAPIRequest()
.
Enables more debug information in this class, such as net request and response headers in all methods. False
by default.
If True
then TKSBrokerAPI generate also HTML reports from Markdown. False
by default.
See also: Mako Templates for Python (https://www.makotemplates.org/). Mako is a template library provides simple syntax and maximum performance.
\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.historyFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.historyFile", "kind": "variable", "doc": "Full path to the output file where history candles will be saved or updated. Default: None
, it mean that returns only Pandas DataFrame.
See also: History()
.
Full path to the html file where rendered candles chart stored. Default: index.html
.
See also: ShowHistoryChart()
.
Filename where full available to user instruments list will be saved. Default: instruments.md
.
See also: ShowInstrumentsInfo()
.
Filename with all found instruments searched by part of its ticker, FIGI or name. Default: search-results.md
.
See also: SearchInstruments()
.
Filename where prices of selected instruments will be saved. Default: prices.md
.
See also: GetListOfPrices()
.
Filename where prices of selected instruments will be saved. Default: prices.md
.
See also: ShowInstrumentsInfo()
, RequestBondCoupons()
and RequestTradingStatus()
.
Filename where wider Pandas DataFrame with more information about bonds: main info, current prices, \nbonds payment calendar, some statistics will be stored. Default: ext-bonds.xlsx
.
See also: ExtendBondsData()
.
Filename where bonds payment calendar will be saved. Default: calendar.md
.
Pandas dataframe with only bonds payment calendar also will be stored to default file calendar.xlsx
.
See also: CreateBondsCalendar()
, ShowBondsCalendar()
, ShowInstrumentInfo()
, RequestBondCoupons()
and ExtendBondsData()
.
Filename where current portfolio, open trades and orders will be saved. Default: overview.md
.
See also: Overview()
, RequestPortfolio()
, RequestPositions()
, RequestPendingOrders()
and RequestStopOrders()
.
Filename where short digest of the portfolio status will be saved. Default: overview-digest.md
.
See also: Overview()
with parameter details=\"digest\"
.
Filename where only open positions, without everything else will be saved. Default: overview-positions.md
.
See also: Overview()
with parameter details=\"positions\"
.
Filename where open limits and stop orders will be saved. Default: overview-orders.md
.
See also: Overview()
with parameter details=\"orders\"
.
Filename where only the analytics section and the distribution of the portfolio by various categories will be saved. Default: overview-analytics.md
.
See also: Overview()
with parameter details=\"analytics\"
.
Filename where only the bonds calendar section will be saved. Default: overview-calendar.md
.
See also: Overview()
with parameter details=\"calendar\"
.
Filename where history of deals and trade statistics will be saved. Default: deals.md
.
See also: Deals()
.
Filename where table of funds available for withdrawal will be saved. Default: limits.md
.
See also: OverviewLimits()
and RequestLimits()
.
Filename where all available user's data (accountId
s, common user information, margin status and tariff connections limit) will be saved. Default: user-info.md
.
See also: OverviewUserInfo()
, RequestAccounts()
, RequestUserInfo()
, RequestMarginStatus()
and RequestTariffLimits()
.
Filename where simple table with all available user accounts (accountId
s) will be saved. Default: accounts.md
.
See also: OverviewAccounts()
, RequestAccounts()
.
Filename where raw data about shares, currencies, bonds, etfs and futures will be stored. Default: dump.json
.
Pandas dataframe with raw instruments data also will be stored to default file dump.xlsx
.
See also: DumpInstruments()
and DumpInstrumentsAsXLSX()
.
Dictionary with raw data about shares, currencies, bonds, etfs and futures from broker server. Auto-updating and saving dump to the iListDumpFile
.
See also: Listing()
, DumpInstruments()
.
PriceGenerator object to work with candles data: load, render interact and non-interact charts and so on.
\n\nSee also: LoadHistory()
, ShowHistoryChart()
and the PriceGenerator project: https://github.com/Tim55667757/PriceGenerator
Setter for string with ticker, e.g. GOOGL
. Tickers may be upper case only.
Use alias for USD000UTSTOM
simple as USD
, EUR_RUB__TOM
as EUR
etc.\nMore tickers aliases here: TKSEnums.TKS_TICKER_ALIASES
.
See also: SearchByTicker()
, SearchInstruments()
.
Setter for string with FIGI, e.g. ticker GOOGL
has FIGI BBG009S39JX6
. FIGIs may be upper case only.
See also: SearchByFIGI()
, SearchInstruments()
.
Send GET or POST request to broker server and receive JSON object.
\n\nself.header: must be defining with dictionary of headers.\nself.body: if define then used as request body. None by default.\nself.timeout: global request timeout, 15 seconds by default.
\n\n\n\n", "signature": "(\tself,\turl: str,\treqType: str = 'GET',\tretry: int = 3,\tpause: int = 5) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.Listing", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.Listing", "kind": "function", "doc": "response JSON (dictionary) from broker.
\n
Gets JSON with raw data about shares, currencies, bonds, etfs and futures from broker server.
\n\n\n\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.DumpInstrumentsAsXLSX", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.DumpInstrumentsAsXLSX", "kind": "function", "doc": "Dictionary with all available broker instruments: currencies, shares, bonds, etfs and futures.
\n
Creates XLSX-formatted dump file with raw data of instruments to further used by data scientists or stock analytics.
\n\nSee also: DumpInstruments()
, Listing()
.
True
then at first updates data with Listing()
method,\notherwise just saves exist iList
as XLSX-file (default: dump.xlsx
) .Receives and returns actual raw data about shares, currencies, bonds, etfs and futures from broker server\nusing Listing()
method. If iListDumpFile
string is not empty then also save information to this file.
See also: DumpInstrumentsAsXLSX()
, Listing()
.
True
then at first updates data with Listing()
method,\notherwise just saves exist iList
as JSON-file (default: dump.json
).\n\n", "signature": "(self, forceUpdate: bool = True) -> str:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.ShowInstrumentInfo", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.ShowInstrumentInfo", "kind": "function", "doc": "serialized JSON formatted
\nstr
with full data of instruments, also saved to the--output
JSON-file.
Show information about one instrument defined by json data and prints it in Markdown format.
\n\nSee also: SearchByTicker()
, SearchByFIGI()
, RequestBondCoupons()
, ExtendBondsData()
, ShowBondsCalendar()
and RequestTradingStatus()
.
iJSON = self.iList[\"Shares\"][self._ticker]
True
then also printing information about instrument and its current price.\n\n", "signature": "(self, iJSON: dict, show: bool = True) -> str:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.SearchByTicker", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.SearchByTicker", "kind": "function", "doc": "multilines text in Markdown format with information about one instrument.
\n
Search and return raw broker's information about instrument by its ticker. Variable ticker
must be defined!
False
then do not request current price of instrument (because this is long operation).False
then do not run ShowInstrumentInfo()
method and do not print info to the console.\n\n", "signature": "(self, requestPrice: bool = False, show: bool = False) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.SearchByFIGI", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.SearchByFIGI", "kind": "function", "doc": "JSON formatted data with information about instrument.
\n
Search and return raw broker's information about instrument by its FIGI. Variable figi
must be defined!
False
then do not request current price of instrument (it's long operation).False
then do not run ShowInstrumentInfo()
method and do not print info to the console.\n\n", "signature": "(self, requestPrice: bool = False, show: bool = False) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.GetCurrentPrices", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.GetCurrentPrices", "kind": "function", "doc": "JSON formatted data with information about instrument.
\n
Get and show Depth of Market with current prices of the instrument as dictionary. Result example with depth
5:\n{\"buy\": [{\"price\": 1243.8, \"quantity\": 193},\n {\"price\": 1244.0, \"quantity\": 168},\n {\"price\": 1244.8, \"quantity\": 5},\n {\"price\": 1245.0, \"quantity\": 61},\n {\"price\": 1245.4, \"quantity\": 60}],\n \"sell\": [{\"price\": 1243.6, \"quantity\": 8},\n {\"price\": 1242.6, \"quantity\": 10},\n {\"price\": 1242.4, \"quantity\": 18},\n {\"price\": 1242.2, \"quantity\": 50},\n {\"price\": 1242.0, \"quantity\": 113}],\n \"limitUp\": 1619.0, \"limitDown\": 903.4, \"lastPrice\": 1243.8, \"closePrice\": 1263.0}
, where parameters mean:
See also: SearchByTicker()
and SearchByFIGI()
.\nREST API for request: https://tinkoff.github.io/investAPI/swagger-ui/#/MarketDataService/MarketDataService_GetOrderBook\nResponse fields: https://tinkoff.github.io/investAPI/marketdata/#getorderbookresponse
True
then print DOM to log and console.\n\n", "signature": "(self, show: bool = True) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.ShowInstrumentsInfo", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.ShowInstrumentsInfo", "kind": "function", "doc": "orders book dict with lists of current buy and sell prices:
\n{\"buy\": [{\"price\": x1, \"quantity\": y1, ...}], \"sell\": [....]}
.\n If an error occurred then returns an empty record:\n{\"buy\": [], \"sell\": [], \"limitUp\": None, \"limitDown\": None, \"lastPrice\": None, \"closePrice\": None}
.
This method get and show information about all available broker instruments for current user account.\nIf instrumentsFile
string is not empty then also save information to this file.
True
then print results to console, if False
\u2014 print only to file.\n\n", "signature": "(self, show: bool = True) -> str:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.SearchInstruments", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.SearchInstruments", "kind": "function", "doc": "multi-lines string with all available broker instruments
\n
This method search and show information about instruments by part of its ticker, FIGI or name.\nIf searchResultsFile
string is not empty then also save information to this file.
True
then print results to console, if False
\u2014 return list of result only.\n\n", "signature": "(self, pattern: str, show: bool = True) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.GetUniqueFIGIs", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.GetUniqueFIGIs", "kind": "function", "doc": "list of dictionaries with all found instruments.
\n
Creating list with unique instrument FIGIs from input list of tickers (priority) or FIGIs.
\n\n\n\n", "signature": "(self, instruments: list[str]) -> list:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.GetListOfPrices", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.GetListOfPrices", "kind": "function", "doc": "list with unique instrument FIGIs only.
\n
This method get, maybe show and return prices of list of instruments. WARNING! This is potential long operation!
\n\nSee limits: https://tinkoff.github.io/investAPI/limits/
\n\nIf pricesFile
string is not empty then also save information to this file.
True
then prints prices to console, if False
\u2014 prints only to file pricesFile
.\n\n", "signature": "(self, instruments: list[str], show: bool = False) -> list[dict]:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.ShowListOfPrices", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.ShowListOfPrices", "kind": "function", "doc": "list of instruments looks like
\n[{some ticker info, \"currentPrice\": {current prices}}, {...}, ...]
.\n One item is dict returned bySearchByTicker()
orSearchByFIGI()
methods.
Show table contains current prices of given instruments.
\n\n[{some ticker info, \"currentPrice\"**: {current prices}}, {...}, ...]
.\nOne item is dict returned by SearchByTicker(requestPrice=True)
or by SearchByFIGI(requestPrice=True)
methods.True
then prints prices to console, if False
\u2014 prints only to file pricesFile
.\n\n", "signature": "(self, iList: list, show: bool = True) -> str:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestTradingStatus", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestTradingStatus", "kind": "function", "doc": "multilines text in Markdown format as a table contains current prices.
\n
Requesting trading status for the instrument defined by figi
variable.
Documentation: https://tinkoff.github.io/investAPI/marketdata/#gettradingstatusrequest
\n\n\n\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestPortfolio", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestPortfolio", "kind": "function", "doc": "dictionary with trading status attributes. Response example:\n
\n{\"figi\": \"TCS00A103X66\", \"tradingStatus\": \"SECURITY_TRADING_STATUS_NOT_AVAILABLE_FOR_TRADING\",\n \"limitOrderAvailableFlag\": false, \"marketOrderAvailableFlag\": false, \"apiTradeAvailableFlag\": true}
Requesting actual user's portfolio for current accountId
.
REST API for user portfolio: https://tinkoff.github.io/investAPI/swagger-ui/#/OperationsService/OperationsService_GetPortfolio
\n\nDocumentation: https://tinkoff.github.io/investAPI/operations/#portfoliorequest
\n\n\n\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestPositions", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestPositions", "kind": "function", "doc": "dictionary with user's portfolio.
\n
Requesting open positions by currencies and instruments for current accountId
.
REST API for open positions: https://tinkoff.github.io/investAPI/swagger-ui/#/OperationsService/OperationsService_GetPositions
\n\nDocumentation: https://tinkoff.github.io/investAPI/operations/#positionsrequest
\n\n\n\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestPendingOrders", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestPendingOrders", "kind": "function", "doc": "dictionary with open positions by instruments.
\n
Requesting current actual pending limit orders for current accountId
.
REST API for pending (market) orders: https://tinkoff.github.io/investAPI/swagger-ui/#/OrdersService/OrdersService_GetOrders
\n\nDocumentation: https://tinkoff.github.io/investAPI/orders/#getordersrequest
\n\n\n\n", "signature": "(self) -> list:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestStopOrders", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestStopOrders", "kind": "function", "doc": "list of dictionaries with pending limit orders.
\n
Requesting current actual stop orders for current accountId
.
REST API for opened stop-orders: https://tinkoff.github.io/investAPI/swagger-ui/#/StopOrdersService/StopOrdersService_GetStopOrders
\n\nDocumentation: https://tinkoff.github.io/investAPI/stoporders/#getstopordersrequest
\n\n\n\n", "signature": "(self) -> list:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.Overview", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.Overview", "kind": "function", "doc": "list of dictionaries with stop orders.
\n
Get portfolio: all open positions, orders and some statistics for current accountId
.\nIf overviewFile
, overviewDigestFile
, overviewPositionsFile
, overviewOrdersFile
, overviewAnalyticsFile
\nand overviewBondsCalendarFile
are defined then also save information to file.
WARNING! It is not recommended to run this method too many times in a loop! The server receives\nmany requests about the state of the portfolio, and then, based on the received data, a large number\nof calculation and statistics are collected.
\n\nFalse
then only dictionary returns, if True
then show more debug information.full
\u2014 shows full available information about portfolio status (by default),positions
\u2014 shows only open positions,orders
\u2014 shows only sections of open limits and stop orders.digest
\u2014 show a short digest of the portfolio status,analytics
\u2014 shows only the analytics section and the distribution of the portfolio by various categories,calendar
\u2014 shows only the bonds calendar section (if these present in portfolio),\n\n", "signature": "(self, show: bool = False, details: str = 'full') -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.Deals", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.Deals", "kind": "function", "doc": "dictionary with client's raw portfolio and some statistics.
\n
Returns history operations between two given dates for current accountId
.\nIf reportFile
string is not empty then also save human-readable report.\nShows some statistical data of closed positions.
TradeRoutines.GetDatesAsString()
method.TradeRoutines.GetDatesAsString()
method.True
then also prints all records to the console.False
then remove information about cancelled operations from the deals report.\n\n", "signature": "(\tself,\tstart: str = None,\tend: str = None,\tshow: bool = False,\tshowCancelled: bool = True) -> tuple[list[dict], dict]:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.History", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.History", "kind": "function", "doc": "original list of dictionaries with history of deals records from API (\"operations\" key):\n https://tinkoff.github.io/investAPI/swagger-ui/#/OperationsService/OperationsService_GetOperations\n and dictionary with custom stats: operations in different currencies, withdrawals, incomes etc.
\n
This method returns last history candles of the current instrument defined by ticker
or figi
(FIGI id).
History returned between two given dates: start
and end
. Minimum requested date in the past is 1970-01-01
.\nWarning! Broker server used ISO UTC time by default.
If historyFile
is not None
then method save history to file, otherwise return only Pandas DataFrame.\nAlso, historyFile
used to update history with onlyMissing
parameter.
See also: LoadHistory()
and ShowHistoryChart()
methods.
TradeRoutines.GetDatesAsString()
method.TradeRoutines.GetDatesAsString()
method.\"1min\"
, \"5min\"
, \"15min\"
,\n\"hour\"
, \"day\"
. Default: \"hour\"
.True
then add only last missing candles, do not request all history length from start
.\nFalse by default. Warning! History appends only from last candle to current time\nwith always update last candle!,
by default.True
then also prints Pandas DataFrame to the console.\n\n", "signature": "(\tself,\tstart: str = None,\tend: str = None,\tinterval: str = 'hour',\tonlyMissing: bool = False,\tcsvSep: str = ',',\tshow: bool = False) -> pandas.core.frame.DataFrame:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.LoadHistory", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.LoadHistory", "kind": "function", "doc": "Pandas DataFrame with prices history. Headers of columns are defined by default:\n
\n[\"date\", \"time\", \"open\", \"high\", \"low\", \"close\", \"volume\"]
.
Load candles history from csv-file and return Pandas DataFrame object.
\n\nSee also: History()
and ShowHistoryChart()
methods.
Render an HTML-file with interact or non-interact candlesticks chart. Candles may be path to the csv-file.
\n\nSelf variable htmlHistoryFile
can be use as html-file name to save interaction or non-interaction chart.\nDefault: index.html
(both for interact and non-interact candlesticks chart).
See also: History()
and LoadHistory()
methods.
permissions denied
to html-file.Universal method to create market order and make deal at the current price for current accountId
. Returns JSON data with response.\nIf tp
or sl
> 0, then in additional will open stop-orders with \"TP\" and \"SL\" flags for stopType
parameter.
See also: Order()
docstring. More simple methods than Trade()
are Buy()
and Sell()
.
targetPrice
in self.Order()
.targetPrice
in self.Order()
.%Y-%m-%d %H:%M:%S
.\n\n", "signature": "(\tself,\toperation: str,\tlots: int = 1,\ttp: float = 0.0,\tsl: float = 0.0,\texpDate: str = 'Undefined') -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.Buy", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.Buy", "kind": "function", "doc": "JSON with response from broker server.
\n
More simple method than Trade()
. Create Buy
market order and make deal at the current price. Returns JSON data with response.\nIf tp
or sl
> 0, then in additional will opens stop-orders with \"TP\" and \"SL\" flags for stopType
parameter.
See also: Order()
and Trade()
docstrings.
%Y-%m-%d %H:%M:%S
.\n\n", "signature": "(\tself,\tlots: int = 1,\ttp: float = 0.0,\tsl: float = 0.0,\texpDate: str = 'Undefined') -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.Sell", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.Sell", "kind": "function", "doc": "JSON with response from broker server.
\n
More simple method than Trade()
. Create Sell
market order and make deal at the current price. Returns JSON data with response.\nIf tp
or sl
> 0, then in additional will open stop-orders with \"TP\" and \"SL\" flags for stopType
parameter.
See also: Order()
and Trade()
docstrings.
%Y-%m-%d %H:%M:%S
.\n\n", "signature": "(\tself,\tlots: int = 1,\ttp: float = 0.0,\tsl: float = 0.0,\texpDate: str = 'Undefined') -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.CloseTrades", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.CloseTrades", "kind": "function", "doc": "JSON with response from broker server.
\n
Close position of given instruments.
\n\nOverview()
method.\nThis avoids unnecessary downloading data from the server.Close all positions of given instruments with defined type.
\n\nOverview()
method.\nThis avoids unnecessary downloading data from the server.Universal method to create market or limit orders with all available parameters for current accountId
.\nSee more simple methods: BuyLimit()
, BuyStop()
, SellLimit()
, SellStop()
.
If orderType is \"Limit\" then create pending limit-order below current price if operation is \"Buy\" and above\ncurrent price if operation is \"Sell\". A limit order has no expiration date, it lasts until the end of the trading day.
\n\nWarning! If you try to create limit-order above current price if \"Buy\" or below current price if \"Sell\"\nthen broker immediately open market order as you can do simple --buy or --sell operations!
\n\nIf orderType is \"Stop\" then creates stop-order with any direction \"Buy\" or \"Sell\".\nWhen current price will go up or down to target price value then broker opens a limit order.\nStop-order is opened with unlimited expiration date by default, or you can define expiration date with expDate parameter.
\n\nOnly one attempt and no retry for opens order. If network issue occurred you can create new request.
\n\n%Y-%m-%d %H:%M:%S
.\nThis date is converting to UTC format for server. This parameter only makes sense for stop-order.\nA limit order has no expiration date, it lasts until the end of the trading day.\n\n", "signature": "(\tself,\toperation: str,\torderType: str,\tlots: int,\ttargetPrice: float,\tlimitPrice: float = 0.0,\tstopType: str = 'Limit',\texpDate: str = 'Undefined') -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.BuyLimit", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.BuyLimit", "kind": "function", "doc": "JSON with response from broker server.
\n
Create pending Buy
limit-order (below current price). You must specify only 2 parameters:\nlots
and target price
to open buy limit-order. If you try to create buy limit-order above current price then\nbroker immediately open Buy
market order, such as if you do simple --buy
operation!\nSee also: Order()
docstring.
\n\n", "signature": "(self, lots: int, targetPrice: float) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.BuyStop", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.BuyStop", "kind": "function", "doc": "JSON with response from broker server.
\n
Create Buy
stop-order. You must specify at least 2 parameters: lots
target price
to open buy stop-order.\nIn additional you can specify 3 parameters for buy stop-order: limit price
>=0, stop type
= Limit|SL|TP,\nexpiration date
= Undefined|%%Y-%%m-%%d %%H:%%M:%%S
. When current price will go up or down to\ntarget price value then broker opens a limit order. See also: Order()
docstring.
%Y-%m-%d %H:%M:%S
.\nThis date is converting to UTC format for server.\n\n", "signature": "(\tself,\tlots: int,\ttargetPrice: float,\tlimitPrice: float = 0.0,\tstopType: str = 'Limit',\texpDate: str = 'Undefined') -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.SellLimit", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.SellLimit", "kind": "function", "doc": "JSON with response from broker server.
\n
Create pending Sell
limit-order (above current price). You must specify only 2 parameters:\nlots
and target price
to open sell limit-order. If you try to create sell limit-order below current price then\nbroker immediately open Sell
market order, such as if you do simple --sell
operation!\nSee also: Order()
docstring.
\n\n", "signature": "(self, lots: int, targetPrice: float) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.SellStop", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.SellStop", "kind": "function", "doc": "JSON with response from broker server.
\n
Create Sell
stop-order. You must specify at least 2 parameters: lots
target price
to open sell stop-order.\nIn additional you can specify 3 parameters for sell stop-order: limit price
>=0, stop type
= Limit|SL|TP,\nexpiration date
= Undefined|%%Y-%%m-%%d %%H:%%M:%%S
. When current price will go up or down to\ntarget price value then broker opens a limit order. See also: Order()
docstring.
%Y-%m-%d %H:%M:%S
.\nThis date is converting to UTC format for server.\n\n", "signature": "(\tself,\tlots: int,\ttargetPrice: float,\tlimitPrice: float = 0.0,\tstopType: str = 'Limit',\texpDate: str = 'Undefined') -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.CloseOrders", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.CloseOrders", "kind": "function", "doc": "JSON with response from broker server.
\n
Cancel order or list of orders by its orderId
or stopOrderId
for current accountId
.
orderId
or stopOrderId
.Gets a list of open pending and stop orders and cancel it all.
\n", "signature": "(self) -> None:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.CloseAll", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.CloseAll", "kind": "function", "doc": "Close all available (not blocked) opened trades and orders.
\n\nAlso, you can select one or more keywords case-insensitive:\norders
, shares
, bonds
, etfs
and futures
from TKS_INSTRUMENTS
enum to specify trades type.
Currency positions you must close manually using buy or sell operations, CloseTrades()
or CloseAllTrades()
methods.
Close all available (not blocked) opened trades and orders for one instrument defined by its ticker.
\n\nThis method searches opened trade and orders of instrument throw all portfolio and then use\nCloseTrades()
and CloseOrders()
methods to close trade and cancel all orders for that instrument.
See also: IsInLimitOrders()
, GetLimitOrderIDs()
, IsInStopOrders()
, GetStopOrderIDs()
, CloseTrades()
and CloseOrders()
.
Close all available (not blocked) opened trades and orders for one instrument defined by its FIGI id.
\n\nThis method searches opened trade and orders of instrument throw all portfolio and then use\nCloseTrades()
and CloseOrders()
methods to close trade and cancel all orders for that instrument.
See also: IsInLimitOrders()
, GetLimitOrderIDs()
, IsInStopOrders()
, GetStopOrderIDs()
, CloseTrades()
and CloseOrders()
.
Parse input dictionary of strings with order parameters and return dictionary with parameters to open all orders.
\n\n{\"lots\": \"L_int,...\", \"prices\": \"P_float,...\"}
where\n\"lots\" key: one or more lot values (integer numbers) to open with every limit-order\n\"prices\" key: one or more prices to open limit-orders\nCounts of values in lots and prices lists must be equals!\n\n", "signature": "(operation, **inputParameters):", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.IsInPortfolio", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.IsInPortfolio", "kind": "function", "doc": "list of dictionaries with all lots and prices to open orders that looks like this
\n[{\"lot\": lots_1, \"price\": price_1}, {...}, ...]
Checks if instrument is in the user's portfolio. Instrument must be defined by ticker
(highly priority) or figi
.
None
, then requests portfolio from Overview()
method.\n\n", "signature": "(self, portfolio: dict = None) -> bool:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.GetInstrumentFromPortfolio", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.GetInstrumentFromPortfolio", "kind": "function", "doc": "\n
True
if portfolio contains open position with given instrument,False
otherwise.
Returns instrument from the user's portfolio if it presents there.\nInstrument must be defined by ticker
(highly priority) or figi
.
None
, then requests portfolio from Overview()
method.\n\n", "signature": "(self, portfolio: dict = None) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.IsInLimitOrders", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.IsInLimitOrders", "kind": "function", "doc": "dict with instrument if portfolio contains open position with this instrument,
\nNone
otherwise.
Checks if instrument is in the limit orders list. Instrument must be defined by ticker
(highly priority) or figi
.
See also: CloseAllByTicker()
and CloseAllByFIGI()
.
None
, then requests portfolio from Overview()
method.\n\n", "signature": "(self, portfolio: dict = None) -> bool:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.GetLimitOrderIDs", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.GetLimitOrderIDs", "kind": "function", "doc": "\n
True
if limit orders list contains some limit orders for the instrument,False
otherwise.
Returns list with all orderID
s of opened pending limit orders for the instrument.\nInstrument must be defined by ticker
(highly priority) or figi
.
See also: CloseAllByTicker()
and CloseAllByFIGI()
.
None
, then requests portfolio from Overview()
method.\n\n", "signature": "(self, portfolio: dict = None) -> list[str]:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.IsInStopOrders", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.IsInStopOrders", "kind": "function", "doc": "list with
\norderID
s of limit orders.
Checks if instrument is in the stop orders list. Instrument must be defined by ticker
(highly priority) or figi
.
See also: CloseAllByTicker()
and CloseAllByFIGI()
.
None
, then requests portfolio from Overview()
method.\n\n", "signature": "(self, portfolio: dict = None) -> bool:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.GetStopOrderIDs", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.GetStopOrderIDs", "kind": "function", "doc": "\n
True
if stop orders list contains some stop orders for the instrument,False
otherwise.
Returns list with all orderID
s of opened stop orders for the instrument.\nInstrument must be defined by ticker
(highly priority) or figi
.
See also: CloseAllByTicker()
and CloseAllByFIGI()
.
None
, then requests portfolio from Overview()
method.\n\n", "signature": "(self, portfolio: dict = None) -> list[str]:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestLimits", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestLimits", "kind": "function", "doc": "list with
\norderID
s of stop orders.
Method for obtaining the available funds for withdrawal for current accountId
.
See also:
\n\nOverviewLimits()
method\n\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.OverviewLimits", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.OverviewLimits", "kind": "function", "doc": "dict with raw data from server that contains free funds for withdrawal. Example of dict:\n
\n{\"money\": [{\"currency\": \"rub\", \"units\": \"100\", \"nano\": 290000000}, {...}], \"blocked\": [...], \"blockedGuarantee\": [...]}
.\n Heremoney
is an array of portfolio currency positions,blocked
is an array of blocked currency\n positions of the portfolio andblockedGuarantee
is locked money under collateral for futures.
Method for parsing and show table with available funds for withdrawal for current accountId
.
See also: RequestLimits()
.
False
then only dictionary returns, if True
then also print withdrawal limits to log.\n\n", "signature": "(self, show: bool = False) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestAccounts", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestAccounts", "kind": "function", "doc": "dict with raw parsed data from server and some calculated statistics about it.
\n
Method for requesting all brokerage accounts (accountId
s) of current user detected by token
.
See also:
\n\nOverviewUserInfo()
method\n\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestUserInfo", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestUserInfo", "kind": "function", "doc": "dict with raw data from server that contains accounts info. Example of dict:\n
\n{\"accounts\": [{\"id\": \"20000xxxxx\", \"type\": \"ACCOUNT_TYPE_TINKOFF\", \"name\": \"TKSBrokerAPI account\",\n \"status\": \"ACCOUNT_STATUS_OPEN\", \"openedDate\": \"2018-05-23T00:00:00Z\",\n \"closedDate\": \"1970-01-01T00:00:00Z\", \"accessLevel\": \"ACCOUNT_ACCESS_LEVEL_FULL_ACCESS\"}, ...]}
.\n IfclosedDate=\"1970-01-01T00:00:00Z\"
it means that account is active now.
Method for requesting common user's information.
\n\nSee also:
\n\nqualified_for_work_with
field mean: https://tinkoff.github.io/investAPI/faq_users/#qualified_for_work_withOverviewUserInfo()
method\n\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestMarginStatus", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestMarginStatus", "kind": "function", "doc": "dict with raw data from server that contains user's information. Example of dict:\n
\n{\"premStatus\": true, \"qualStatus\": false, \"qualifiedForWorkWith\": [\"bond\", \"foreign_shares\", \"leverage\",\n \"russian_shares\", \"structured_income_bonds\"], \"tariff\": \"premium\"}
.
Method for requesting margin calculation for defined account ID.
\n\nSee also:
\n\nOverviewUserInfo()
methodNone
, then used class field accountId
.\n\n", "signature": "(self, accountId: str = None) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestTariffLimits", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestTariffLimits", "kind": "function", "doc": "dict with raw data from server that contains margin calculation. If margin is disabled then returns empty dict.\n Example of responses:\n status code 400:
\n{\"code\": 3, \"message\": \"account margin status is disabled\", \"description\": \"30051\" }
, returns:{}
.\n status code 200:{\"liquidPortfolio\": {\"currency\": \"rub\", \"units\": \"7175\", \"nano\": 560000000},\n \"startingMargin\": {\"currency\": \"rub\", \"units\": \"6311\", \"nano\": 840000000},\n \"minimalMargin\": {\"currency\": \"rub\", \"units\": \"3155\", \"nano\": 920000000},\n \"fundsSufficiencyLevel\": {\"units\": \"1\", \"nano\": 280000000},\n \"amountOfMissingFunds\": {\"currency\": \"rub\", \"units\": \"-863\", \"nano\": -720000000}}
.
Method for requesting limits of current tariff (connections, API methods etc.) of current user detected by token
.
See also:
\n\nOverviewUserInfo()
method\n\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestBondCoupons", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestBondCoupons", "kind": "function", "doc": "dict with raw data from server that contains limits of current tariff. Example of dict:\n
\n{\"unaryLimits\": [{\"limitPerMinute\": 0, \"methods\": [\"methods\", \"methods\"]}, ...],\n \"streamLimits\": [{\"streams\": [\"streams\", \"streams\"], \"limit\": 6}, ...]}
.
Requesting bond payment calendar from official placement date to maturity date. If these dates are unknown\nthen requesting dates \"from\": \"1970-01-01T00:00:00.000Z\"
and \"to\": \"2099-12-31T23:59:59.000Z\"
.\nAll dates are in UTC timezone.
REST API: https://tinkoff.github.io/investAPI/swagger-ui/#/InstrumentsService/InstrumentsService_GetBondCoupons\nDocumentation:
\n\nSee also: ExtendBondsData()
.
iJSON = self.iList[\"Bonds\"][self._ticker]
\nIf raw iJSON is not data of bond then server returns an error [400] with message:\n{\"code\": 3, \"message\": \"instrument type is not bond\", \"description\": \"30048\"}
.\n\n", "signature": "(self, iJSON: dict) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.ExtendBondsData", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.ExtendBondsData", "kind": "function", "doc": "dictionary with bond payment calendar. Response example\n
\n{\"events\": [{\"figi\": \"TCS00A101YV8\", \"couponDate\": \"2023-07-26T00:00:00Z\", \"couponNumber\": \"12\",\n \"fixDate\": \"2023-07-25T00:00:00Z\", \"payOneBond\": {\"currency\": \"rub\", \"units\": \"7\", \"nano\": 170000000},\n \"couponType\": \"COUPON_TYPE_CONSTANT\", \"couponStartDate\": \"2023-04-26T00:00:00Z\",\n \"couponEndDate\": \"2023-07-26T00:00:00Z\", \"couponPeriod\": 91}, {...}, ...]}
Requests jsons with raw bonds data for every ticker or FIGI in instruments list and transform it to the wider\nPandas DataFrame with more information about bonds: main info, current prices, bond payment calendar,\ncoupon yields, current yields and some statistics etc.
\n\nWARNING! This is too long operation if a lot of bonds requested from broker server.
\n\nSee also: ShowInstrumentInfo()
, CreateBondsCalendar()
, ShowBondsCalendar()
, RequestBondCoupons()
.
bondsXLSXFile
, default ext-bonds.xlsx
,\nfor further used by data scientists or stock analytics.\n\n", "signature": "(\tself,\tinstruments: list[str],\txlsx: bool = False) -> pandas.core.frame.DataFrame:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.CreateBondsCalendar", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.CreateBondsCalendar", "kind": "function", "doc": "wider Pandas DataFrame with more full and calculated data about bonds, than raw response from broker.\n In XLSX-file and Pandas DataFrame fields mean:\n - main info about bond: https://tinkoff.github.io/investAPI/instruments/#bond\n - info about coupon: https://tinkoff.github.io/investAPI/instruments/#coupon
\n
Creates bond payments calendar as Pandas DataFrame, and also save it to the XLSX-file, calendar.xlsx
by default.
WARNING! This is too long operation if a lot of bonds requested from broker server.
\n\nSee also: ShowBondsCalendar()
, ExtendBondsData()
.
ExtendBondsData()
method and contains\nextended information about bonds: main info, current prices, bond payment calendar,\ncoupon yields, current yields and some statistics etc.\nIf this parameter is None
then used figi
or ticker
as bond name and then calculate ExtendBondsData()
.calendarFile
+ \".xlsx\"
, calendar.xlsx
by default,\nfor further used by data scientists or stock analytics.\n\n", "signature": "(\tself,\textBonds: pandas.core.frame.DataFrame,\txlsx: bool = False) -> pandas.core.frame.DataFrame:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.ShowBondsCalendar", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.ShowBondsCalendar", "kind": "function", "doc": "Pandas DataFrame with only bond payments calendar data. Fields mean: https://tinkoff.github.io/investAPI/instruments/#coupon
\n
Show bond payments calendar as a table. One row in input bonds
dataframe contains one bond.\nAlso, creates Markdown file with calendar data, calendar.md
by default.
See also: ShowInstrumentInfo()
, RequestBondCoupons()
, CreateBondsCalendar()
and ExtendBondsData()
.
ExtendBondsData()
method and contains\nextended information about bonds: main info, current prices, bond payment calendar,\ncoupon yields, current yields and some statistics etc.\nIf this parameter is None
then used figi
or ticker
as bond name and then calculate ExtendBondsData()
.True
then also printing bonds payment calendar to the console,\notherwise save to file calendarFile
only. False
by default.\n\n", "signature": "(self, extBonds: pandas.core.frame.DataFrame, show: bool = True) -> str:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.OverviewAccounts", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.OverviewAccounts", "kind": "function", "doc": "multilines text in Markdown format with bonds payment calendar as a table.
\n
Method for parsing and show simple table with all available user accounts.
\n\nSee also: RequestAccounts()
and OverviewUserInfo()
methods.
False
then only dictionary with accounts data returns, if True
then also print it to log.\n\n", "signature": "(self, show: bool = False) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.OverviewUserInfo", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.OverviewUserInfo", "kind": "function", "doc": "dict with parsed accounts data received from
\nRequestAccounts()
method. Example of dict:\nview = {\"rawAccounts\": {rawAccounts from RequestAccounts() method...},\n \"stat\": {\"accountId string\": {\"type\": \"Tinkoff brokerage account\", \"name\": \"Test - 1\",\n \"status\": \"Opened and active account\", \"opened\": \"2018-05-23 00:00:00\",\n \"closed\": \"\u2014\", \"access\": \"Full access\" }, ...}}
Method for parsing and show all available user's data (accountId
s, common user information, margin status and tariff connections limit).
See also: OverviewAccounts()
, RequestAccounts()
, RequestUserInfo()
, RequestMarginStatus()
and RequestTariffLimits()
methods.
False
then only dictionary returns, if True
then also print user's data to log.\n\n", "signature": "(self, show: bool = False) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.Args", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "Args", "kind": "class", "doc": "dict with raw parsed data from server and some calculated statistics about it.
\n
If Main()
function is imported as module, then this class used to convert arguments from **kwargs as object.
This function get and parse command line keys.
\n", "signature": "():", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.Main", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "Main", "kind": "function", "doc": "Main function for work with TKSBrokerAPI in the console.
\n\nSee examples:
\n\nModule contains a lot of constants from enums sections of Tinkoff Open API documentation used by TKSBrokerAPI module.
\n\nDate and time string format used by Tinkoff Open API. Default: \"%Y-%m-%dT%H:%M:%SZ\"
.
Extended date and time string format used by Tinkoff Open API. Default: \"%Y-%m-%dT%H:%M:%S.%fZ\"
.
Date string format for some methods. Default: \"%Y-%m-%d\"
.
Human-readable format of date and time string. Default: \"%Y-%m-%d %H:%M:%S\"
.
Type of instrument for trade methods must be only one of supported types, listed in this constant. Default: [\"Currencies\", \"Shares\", \"Bonds\", \"Etfs\", \"Futures\"]
Some aliases instead official tickers for using in CLI. For example, you can use \"USD\"
instead of \"USD000UTSTOM\"
.
Candles interval for requesting history data with Tinkoff API. Current available keys are \"1min\"
, \"5min\"
, \"15min\"
, \"hour\"
, \"day\"
.\nSee more: https://tinkoff.github.io/investAPI/swagger-ui/#/MarketDataService/MarketDataService_GetCandles
Account status, enums: https://tinkoff.github.io/investAPI/users/#accountstatus
\n", "default_value": " = {'ACCOUNT_STATUS_UNSPECIFIED': 'Account status undefined', 'ACCOUNT_STATUS_NEW': 'New, open in progress...', 'ACCOUNT_STATUS_OPEN': 'Opened and active account', 'ACCOUNT_STATUS_CLOSED': 'Closed account'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_ACCOUNT_TYPES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_ACCOUNT_TYPES", "kind": "variable", "doc": "Account type, enums: https://tinkoff.github.io/investAPI/users/#accounttype
\n", "default_value": " = {'ACCOUNT_TYPE_UNSPECIFIED': 'Account type undefined', 'ACCOUNT_TYPE_TINKOFF': 'Tinkoff brokerage account', 'ACCOUNT_TYPE_TINKOFF_IIS': 'IIS account', 'ACCOUNT_TYPE_INVEST_BOX': 'Investment "piggy bank"'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_ACCESS_LEVELS", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_ACCESS_LEVELS", "kind": "variable", "doc": "Access level, enums: https://tinkoff.github.io/investAPI/users/#accesslevel
\n", "default_value": " = {'ACCOUNT_ACCESS_LEVEL_UNSPECIFIED': 'Access level undefined', 'ACCOUNT_ACCESS_LEVEL_FULL_ACCESS': 'Full access', 'ACCOUNT_ACCESS_LEVEL_READ_ONLY': 'Read-only access', 'ACCOUNT_ACCESS_LEVEL_NO_ACCESS': 'No access'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_QUALIFIED_TYPES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_QUALIFIED_TYPES", "kind": "variable", "doc": "Values of qualified_for_work_with
, field: https://tinkoff.github.io/investAPI/faq_users/#qualified_for_work_with
Security Trading Status, enums: https://tinkoff.github.io/investAPI/orders/#securitytradingstatus
\n", "default_value": " = {'SECURITY_TRADING_STATUS_UNSPECIFIED': 'Trading status undefined', 'SECURITY_TRADING_STATUS_NOT_AVAILABLE_FOR_TRADING': 'Not available for trading', 'SECURITY_TRADING_STATUS_OPENING_PERIOD': 'Trade opening period', 'SECURITY_TRADING_STATUS_CLOSING_PERIOD': 'Trade closing period', 'SECURITY_TRADING_STATUS_BREAK_IN_TRADING': 'Break in trading', 'SECURITY_TRADING_STATUS_NORMAL_TRADING': 'Normal trading', 'SECURITY_TRADING_STATUS_CLOSING_AUCTION': 'Closing auction', 'SECURITY_TRADING_STATUS_DARK_POOL_AUCTION': 'Large package auction', 'SECURITY_TRADING_STATUS_DISCRETE_AUCTION': 'Discrete auction', 'SECURITY_TRADING_STATUS_OPENING_AUCTION_PERIOD': 'Opening auction', 'SECURITY_TRADING_STATUS_TRADING_AT_CLOSING_AUCTION_PRICE': 'Trading period at the closing auction price', 'SECURITY_TRADING_STATUS_SESSION_ASSIGNED': 'Session assigned', 'SECURITY_TRADING_STATUS_SESSION_CLOSE': 'Session closed', 'SECURITY_TRADING_STATUS_SESSION_OPEN': 'Session is open', 'SECURITY_TRADING_STATUS_DEALER_NORMAL_TRADING': "Broker's internal liquidity mode trading", 'SECURITY_TRADING_STATUS_DEALER_BREAK_IN_TRADING': "Break in trading in the broker's internal liquidity mode", 'SECURITY_TRADING_STATUS_DEALER_NOT_AVAILABLE_FOR_TRADING': "Broker's internal liquidity mode is not available"}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_OPERATION_TYPES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_OPERATION_TYPES", "kind": "variable", "doc": "Operation type, enums: https://tinkoff.github.io/investAPI/operations/#operationtype
\n", "default_value": " = {'OPERATION_TYPE_UNSPECIFIED': 'The operation type is not defined', 'OPERATION_TYPE_INPUT': 'Deposit on broker account', 'OPERATION_TYPE_BOND_TAX': 'Withholding personal income tax on bond coupons', 'OPERATION_TYPE_OUTPUT_SECURITIES': 'Securities output', 'OPERATION_TYPE_OVERNIGHT': 'Overnight REPO income', 'OPERATION_TYPE_TAX': 'Tax withholding', 'OPERATION_TYPE_BOND_REPAYMENT_FULL': 'Full bond redemption', 'OPERATION_TYPE_SELL_CARD': 'Sell securities from the card', 'OPERATION_TYPE_DIVIDEND_TAX': 'Withholding tax on dividends', 'OPERATION_TYPE_OUTPUT': 'Withdrawals', 'OPERATION_TYPE_BOND_REPAYMENT': 'Bonds partial redemption', 'OPERATION_TYPE_TAX_CORRECTION': 'Tax correction', 'OPERATION_TYPE_SERVICE_FEE': 'Brokerage account maintenance fee deduction', 'OPERATION_TYPE_BENEFIT_TAX': 'Withholding tax for material benefits', 'OPERATION_TYPE_MARGIN_FEE': 'Withholding commission for an uncovered position', 'OPERATION_TYPE_BUY': 'Buy securities', 'OPERATION_TYPE_BUY_CARD': 'Buy securities from a card', 'OPERATION_TYPE_INPUT_SECURITIES': 'Transfer securities from another depository', 'OPERATION_TYPE_SELL_MARGIN': 'Sell (by margin call)', 'OPERATION_TYPE_BROKER_FEE': 'Operation fee deduction', 'OPERATION_TYPE_BUY_MARGIN': 'Buy (by margin call)', 'OPERATION_TYPE_DIVIDEND': 'Dividends income', 'OPERATION_TYPE_SELL': 'Sell securities', 'OPERATION_TYPE_COUPON': 'Coupons income', 'OPERATION_TYPE_SUCCESS_FEE': 'Success fee deduction', 'OPERATION_TYPE_DIVIDEND_TRANSFER': 'Transfer of dividend income', 'OPERATION_TYPE_ACCRUING_VARMARGIN': 'Variation margin crediting', 'OPERATION_TYPE_WRITING_OFF_VARMARGIN': 'Withholding variation margin', 'OPERATION_TYPE_DELIVERY_BUY': 'Buy (futures contract expired)', 'OPERATION_TYPE_DELIVERY_SELL': 'Sell (futures contract expired)', 'OPERATION_TYPE_TRACK_MFEE': 'Autotrack account management fee', 'OPERATION_TYPE_TRACK_PFEE': 'Pay per result on auto follow score', 'OPERATION_TYPE_TAX_PROGRESSIVE': 'Tax withholding at the rate of 15%', 'OPERATION_TYPE_BOND_TAX_PROGRESSIVE': 'Withholding tax on coupons at the rate of 15%', 'OPERATION_TYPE_DIVIDEND_TAX_PROGRESSIVE': 'Withholding tax on dividends at the rate of 15%', 'OPERATION_TYPE_BENEFIT_TAX_PROGRESSIVE': 'Withholding tax for material benefits at the rate of 15%', 'OPERATION_TYPE_TAX_CORRECTION_PROGRESSIVE': 'Tax correction at the rate of 15%', 'OPERATION_TYPE_TAX_REPO_PROGRESSIVE': 'Withholding tax on refunds on REPO transactions at the rate of 15%', 'OPERATION_TYPE_TAX_REPO': 'Tax withholding on REPO trade refunds', 'OPERATION_TYPE_TAX_REPO_HOLD': 'Tax hold on REPO transactions', 'OPERATION_TYPE_TAX_REPO_REFUND': 'Tax refund on REPO transactions', 'OPERATION_TYPE_TAX_REPO_HOLD_PROGRESSIVE': 'Withholding tax on REPO transactions at the rate of 15%', 'OPERATION_TYPE_TAX_REPO_REFUND_PROGRESSIVE': 'Tax refund on REPO transactions at the rate of 15%', 'OPERATION_TYPE_DIV_EXT': 'Payout dividends to the card', 'OPERATION_TYPE_TAX_CORRECTION_COUPON': 'Coupon tax correction'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_OPERATION_STATES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_OPERATION_STATES", "kind": "variable", "doc": "Operation state, enums: https://tinkoff.github.io/investAPI/operations/#operationstate
\n", "default_value": " = {'OPERATION_STATE_UNSPECIFIED': '! Unknown', 'OPERATION_STATE_EXECUTED': '\u221a Executed', 'OPERATION_STATE_CANCELED': '\u00d7 Canceled', 'OPERATION_STATE_PROGRESS': '\u21bb Progress'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_ORDER_DIRECTIONS", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_ORDER_DIRECTIONS", "kind": "variable", "doc": "Order direction, enums: https://tinkoff.github.io/investAPI/orders/#orderdirection
\n", "default_value": " = {'ORDER_DIRECTION_UNSPECIFIED': 'Undefined', 'ORDER_DIRECTION_BUY': '\u2191 Buy', 'ORDER_DIRECTION_SELL': '\u2193 Sell'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_STOP_ORDER_DIRECTIONS", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_STOP_ORDER_DIRECTIONS", "kind": "variable", "doc": "Stop-order direction, enums: https://tinkoff.github.io/investAPI/stoporders/#stoporderdirection
\n", "default_value": " = {'STOP_ORDER_DIRECTION_UNSPECIFIED': 'Undefined', 'STOP_ORDER_DIRECTION_BUY': '\u2191 Buy', 'STOP_ORDER_DIRECTION_SELL': '\u2193 Sell'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_ORDER_TYPES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_ORDER_TYPES", "kind": "variable", "doc": "Order type, enums: https://tinkoff.github.io/investAPI/orders/#ordertype
\n", "default_value": " = {'ORDER_TYPE_UNSPECIFIED': 'Undefined', 'ORDER_TYPE_LIMIT': 'Limit', 'ORDER_TYPE_MARKET': 'Market'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_STOP_ORDER_TYPES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_STOP_ORDER_TYPES", "kind": "variable", "doc": "Stop-order type, enums: https://tinkoff.github.io/investAPI/stoporders/#stopordertype
\n", "default_value": " = {'STOP_ORDER_TYPE_UNSPECIFIED': 'Undefined', 'STOP_ORDER_TYPE_TAKE_PROFIT': 'Take profit', 'STOP_ORDER_TYPE_STOP_LOSS': 'Stop loss', 'STOP_ORDER_TYPE_STOP_LIMIT': 'Stop limit'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_ORDER_STATES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_ORDER_STATES", "kind": "variable", "doc": "Order status, enums: https://tinkoff.github.io/investAPI/orders/#orderexecutionreportstatus
\n", "default_value": " = {'EXECUTION_REPORT_STATUS_UNSPECIFIED': '! Unknown', 'EXECUTION_REPORT_STATUS_FILL': 'Performed', 'EXECUTION_REPORT_STATUS_REJECTED': 'Rejected', 'EXECUTION_REPORT_STATUS_CANCELLED': 'Cancelled', 'EXECUTION_REPORT_STATUS_NEW': 'New order', 'EXECUTION_REPORT_STATUS_PARTIALLYFILL': 'Partially filled'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_STOP_ORDER_EXPIRATION_TYPES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_STOP_ORDER_EXPIRATION_TYPES", "kind": "variable", "doc": "Expiration type of stop-orders, enums: https://tinkoff.github.io/investAPI/stoporders/#stoporderexpirationtype
\n", "default_value": " = {'STOP_ORDER_EXPIRATION_TYPE_UNSPECIFIED': 'Undefined', 'STOP_ORDER_EXPIRATION_TYPE_GOOD_TILL_CANCEL': 'Until cancel', 'STOP_ORDER_EXPIRATION_TYPE_GOOD_TILL_DATE': 'Until date'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_COUPON_TYPES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_COUPON_TYPES", "kind": "variable", "doc": "Coupon type of bonds, enums: https://tinkoff.github.io/investAPI/instruments/#coupontype
\n", "default_value": " = {'COUPON_TYPE_UNSPECIFIED': 'Undefined', 'COUPON_TYPE_CONSTANT': 'Constant', 'COUPON_TYPE_FLOATING': 'Floating', 'COUPON_TYPE_DISCOUNT': 'Discount', 'COUPON_TYPE_MORTGAGE': 'Mortgage', 'COUPON_TYPE_FIX': 'Fixed', 'COUPON_TYPE_VARIABLE': 'Variable', 'COUPON_TYPE_OTHER': 'Other'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_REAL_EXCHANGES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_REAL_EXCHANGES", "kind": "variable", "doc": "The real exchange for the execution of trades, enums: https://tinkoff.github.io/investAPI/instruments/#realexchange
\n", "default_value": " = {'REAL_EXCHANGE_UNSPECIFIED': 'Undefined', 'REAL_EXCHANGE_MOEX': 'MOEX', 'REAL_EXCHANGE_RTS': 'SPBEX', 'REAL_EXCHANGE_OTC': 'OTC'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_SHARE_TYPES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_SHARE_TYPES", "kind": "variable", "doc": "Share type, enums: https://tinkoff.github.io/investAPI/instruments/#sharetype
\n", "default_value": " = {'SHARE_TYPE_UNSPECIFIED': 'Undefined', 'SHARE_TYPE_COMMON': 'Ordinary', 'SHARE_TYPE_PREFERRED': 'Privileged', 'SHARE_TYPE_ADR': 'American Depositary Receipts (ADR)', 'SHARE_TYPE_GDR': 'Global Depositary Receipts (GDR)', 'SHARE_TYPE_MLP': 'Master Limited Partnership (MLP)', 'SHARE_TYPE_NY_REG_SHRS': 'New York registered shares', 'SHARE_TYPE_CLOSED_END_FUND': 'Closed investment fund', 'SHARE_TYPE_REIT': 'Real estate trust'}"}, {"fullname": "tksbrokerapi.Templates", "modulename": "tksbrokerapi.Templates", "kind": "module", "doc": "Module contains some html-templates used by reporting methods in TKSBrokerAPI module.
\n\nThis HTML-template used for translating all Markdown-reports to HTML.
\n", "default_value": " = '<!DOCTYPE html>\\n<html lang="en">\\n<html>\\n<head>\\n <meta charset="utf-8"/>\\n <title>${mainTitle}</title>\\n <link rel="stylesheet" type="text/css" href="X:\\\\work\\\\projects\\\\FuzzyMarketAnalytics\\\\public\\\\style.css">\\n <style>${commonCSS}\\n </style>\\n</head>\\n <body>\\n <a href="https://github.com/Tim55667757/TKSBrokerAPI/" target="_blank" rel="noopener noreferrer"><img class="logo" src="https://github.com/Tim55667757/TKSBrokerAPI/blob/develop/docs/media/TKSBrokerAPI-Logo-mini.png?raw=true" alt="TKSBrokerAPI-Logo"></a>\\n <div id="content"></div>\\n <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>\\n <script>\\n var markdown = `${markdown}`; \\n document.getElementById("content").innerHTML = marked.parse(markdown);\\n </script>\\n <div id="footer" class="footer-div">\\n <a href="https://github.com/Tim55667757/TKSBrokerAPI/" target="_blank" rel="noopener noreferrer"><img class="logo2" src="https://github.com/Tim55667757/TKSBrokerAPI/blob/develop/docs/media/TKSBrokerAPI-Logo-text.png?raw=true" alt="TKSBrokerAPI Trade Automation Platform"></a>\\n <div style="display: flex; float: right; justify-content: space-between; padding: 12px 10px 2px 0; margin: 0;"><b>Report generated by <a href="https://github.com/Tim55667757/TKSBrokerAPI/blob/master/README_EN.md" target="_blank" rel="noopener noreferrer">TKSBrokerAPI</a></b></div>\\n </div>\\n </body>\\n</html>'"}, {"fullname": "tksbrokerapi.Templates.COMMON_CSS", "modulename": "tksbrokerapi.Templates", "qualname": "COMMON_CSS", "kind": "variable", "doc": "Common CSS used by all templates.
\n", "default_value": " = '\\n body {\\n background-image: url("data:image/svg+xml;utf8,<svg xmlns=\\'http://www.w3.org/2000/svg\\' version=\\'1.1\\' height=\\'100px\\' width=\\'150px\\'><text transform=\\'translate(20, 100) rotate(-45)\\' fill=\\'rgb(176,176,176)\\' font-size=\\'20\\' opacity=\\'0.25\\'>TKSBrokerAPI</text></svg>");\\n }\\n\\n .logo {\\n width: 120px;\\n float: right;\\n opacity: 0.5;\\n filter: alpha(opacity=40);\\n border-radius: 55px 55px 55px 55px;\\n margin: 0 0 12px 0;\\n }\\n\\n .logo:hover {\\n opacity: 1.0;\\n filter: alpha(opacity=100);\\n }\\n\\n .logo2 {\\n height: 40px;\\n float: left;\\n opacity: 1.0;\\n filter: alpha(opacity=100);\\n border-radius: 25px 25px 25px 25px;\\n padding: 0;\\n margin: 0;\\n }\\n\\n .footer-div {\\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\\n font-size: 12px;\\n color: #333333;\\n background: #E6E6E6;\\n margin: 24px 0 24px 0;\\n border-radius: 20px 20px 20px 20px;\\n padding: 2px 2px 2px 10px;\\n height: 40px;\\n }\\n\\n p {\\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\\n font-size: 13px;\\n padding: 2px;\\n margin: 0;\\n }\\n \\n li {\\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\\n font-size: 13px;\\n padding: 1px 10px;\\n }\\n \\n mark {\\n background: #FFFFE6;\\n padding: 0 3px;\\n }\\n \\n h1 {\\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\\n font-size: 22px;\\n color: #333333;\\n margin: 24px 0 12px 0;\\n }\\n \\n h2 {\\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\\n font-size: 20px;\\n color: #333333;\\n margin: 20px 0 10px 22px;\\n }\\n \\n h3 {\\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\\n font-size: 18px;\\n color: #333333;\\n margin: 16px 0 8px 52px;\\n }\\n \\n details {\\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\\n font-size: 13px;\\n padding: 2px 0;\\n width: 100%;\\n border-radius: 10px 10px 10px 10px;\\n color: #333333;\\n }\\n \\n summary {\\n width: 100%;\\n border-radius: 10px 10px 10px 10px;\\n background: #CCCCCC;\\n height: 20px;\\n display: block;\\n color: #333333;\\n cursor: pointer;\\n }\\n \\n summary::marker {\\n display: none;\\n }\\n \\n summary::before {\\n content: "\\x11B7";\\n padding-right: 0.5em;\\n }\\n \\n details[open] > summary::before {\\n content: "\\x02B8D";\\n }\\n \\n .expand {\\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\\n font-size: 13px;\\n border: none;\\n }\\n \\n .expand::-ms-expand {\\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\\n font-size: 13px;\\n border-radius: 10px;\\n }\\n \\n table {\\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\\n font-size: 13px;\\n width: 100%;\\n border-radius: 40px 40px 10px 10px;\\n border-spacing: 0;\\n text-align: left;\\n background: #FFFFFF;\\n color: #333333;\\n }\\n \\n td {\\n border-style: solid;\\n border-width: 0 1px 1px 0;\\n border-color: white;\\n padding: 12px;\\n vertical-align: top;\\n background: #E6E6E6;\\n }\\n \\n th {\\n border-style: solid;\\n border-width: 0 1px 1px 0;\\n border-color: white;\\n font-size: 14px;\\n vertical-align: top;\\n background: #BFBFBF;\\n text-align: center;\\n }\\n \\n th:first-child {\\n background: #BFBFBF;\\n border-radius: 40px 0 0 0;\\n }\\n \\n th:last-child {\\n background: #BFBFBF;\\n border-radius: 0 40px 0 0;\\n }\\n\\n tr:first-child td:first-child {\\n border-style: solid;\\n border-width: 0 1px 1px 0;\\n border-color: white;\\n padding: 12px;\\n vertical-align: top;\\n background: #E6E6E6;\\n border-radius: 0 0 0 0;\\n }\\n\\n tr:first-child td:last-child {\\n border-style: solid;\\n border-width: 0 1px 1px 0;\\n border-color: white;\\n padding: 12px;\\n vertical-align: top;\\n background: #E6E6E6;\\n border-radius: 0 0 0 0;\\n }\\n\\n tr:last-child td:first-child {\\n background: #E6E6E6;\\n border-radius: 0 0 0 20px;\\n }\\n\\n tr:last-child td:last-child {\\n background: #E6E6E6;\\n border-radius: 0 0 20px 0;\\n }'"}, {"fullname": "tksbrokerapi.TradeRoutines", "modulename": "tksbrokerapi.TradeRoutines", "kind": "module", "doc": "This library contains some methods used by trade scenarios implemented with TKSBrokerAPI module.
\n\nCreate tuple of date and time strings with timezone parsed from user-friendly date.
\n\nWarning! All dates must be in UTC time zone!
\n\nUser dates format must be like: \"%Y-%m-%d\"
, e.g. \"2020-02-03\"
(3 Feb, 2020).
Output date is UTC ISO time format by default: \"%Y-%m-%dT%H:%M:%SZ\"
.
Example input: start=\"2022-06-01\", end=\"2022-06-20\"
-> output: (\"2022-06-01T00:00:00Z\", \"2022-06-20T23:59:59Z\")
.\nAn error exception will occur if input date has incorrect format.
If start=None
, end=None
then return dates from yesterday to the end of the day.
If start=some_date_1
, end=None
then return dates from some_date_1
to the end of the day.
If start=some_date_1
, end=some_date_2
then return dates from start of some_date_1
to end of some_date_2
.
Start day may be negative integer numbers: -1
, -2
, -3
\u2014 how many days ago.
Also, you can use keywords for start if end=None
:
today
(from 00:00:00 to the end of current day),yesterday
(-1 day from 00:00:00 to 23:59:59),week
(-7 day from 00:00:00 to the end of current day),month
(-30 day from 00:00:00 to the end of current day),year
(-365 day from 00:00:00 to the end of current day),userFormat
or keyword.userFormat
.\"%Y-%m-%d\"
.\n\n", "signature": "(\tstart: str = None,\tend: str = None,\tuserFormat: str = '%Y-%m-%d',\toutputFormat: str = '%Y-%m-%dT%H:%M:%SZ') -> tuple[str, str]:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TradeRoutines.NanoToFloat", "modulename": "tksbrokerapi.TradeRoutines", "qualname": "NanoToFloat", "kind": "function", "doc": "tuple with 2 strings
\n(\"start\", \"end\")
. Example of return is(\"2022-06-01T00:00:00Z\", \"2022-06-20T23:59:59Z\")
.\n Second string is the end of the last day.
Convert number in nano-view mode with string parameter units
and integer parameter nano
to float view. Examples:
NanoToFloat(units=\"2\", nano=500000000) -> 2.5
NanoToFloat(units=\"0\", nano=50000000) -> 0.05
\n\n", "signature": "(units: str, nano: int) -> float:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TradeRoutines.FloatToNano", "modulename": "tksbrokerapi.TradeRoutines", "qualname": "FloatToNano", "kind": "function", "doc": "float view of number
\n
Convert float number to nano-type view: dictionary with string units
and integer nano
parameters {\"units\": \"string\", \"nano\": integer}
. Examples:
FloatToNano(number=2.5) -> {\"units\": \"2\", \"nano\": 500000000}
FloatToNano(number=0.05) -> {\"units\": \"0\", \"nano\": 50000000}
\n\n", "signature": "(number: float) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TradeRoutines.UpdateClassFields", "modulename": "tksbrokerapi.TradeRoutines", "qualname": "UpdateClassFields", "kind": "function", "doc": "nano-type view of number:
\n{\"units\": \"string\", \"nano\": integer}
This method get config as dictionary (preloaded from YAML file) and apply key: value
as names of class fields and\nvalues of class fields. Example for class TradeScenario
:\nconfig[\"tickers\"] = [\"TICKER1\", \"TICKER2\"] ==> TradeScenario(TinkoffBrokerServer).tickers = [\"TICKER1\", \"TICKER2\"]
.
key**: value
format.Gets input list and try to separate it by equal parts of elements.
\n\nExamples:\nSeparateByEqualParts(elements=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], parts=2) -> [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]\nSeparateByEqualParts(elements=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], parts=2, union=True) -> [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9, 10]]\nSeparateByEqualParts(elements=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], parts=2, union=False) -> [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [10]]]\nSeparateByEqualParts(elements=[1, 2, 3], parts=2, union=True) -> [[1], [2, 3]]\nSeparateByEqualParts(elements=[1, 2, 3], parts=2, union=False) -> [[1], [2], [3]]
\n\nIf parts > length of elements:\nSeparateByEqualParts(elements=[1], parts=2, union=True) -> [[1]]\nSeparateByEqualParts(elements=[1, 2, 3], parts=4, union=True) -> [[1], [2], [3]]\nSeparateByEqualParts(elements=[1], parts=2, union=False) -> [[1], []]\nSeparateByEqualParts(elements=[1, 2, 3], parts=4, union=False) -> [[1], [2], [3], []]
\n\n\n\n", "signature": "(elements: list, parts: int = 2, union: bool = True) -> list:", "funcdef": "def"}, {"fullname": "tksbrokerapi.UniLogger", "modulename": "tksbrokerapi.UniLogger", "kind": "module", "doc": "list of lists with equal parts of objects.
\n
This module init standard python logging system with some of pre-defined parameters,\ne.g. debug level for log-file, info level for console, log-rotate and so on.
\n\nCurrent internal logger name for TKSBrokerAPI module is TKSBrokerAPI-UniLogger
.
This procedure setting up UniLogger verbosity level.
\n", "signature": "(vLevel='ERROR'):", "funcdef": "def"}, {"fullname": "tksbrokerapi.UniLogger.LevelFilter", "modulename": "tksbrokerapi.UniLogger", "qualname": "LevelFilter", "kind": "class", "doc": "Class using to set up log level filtering.
\n", "bases": "logging.Filter"}, {"fullname": "tksbrokerapi.UniLogger.LevelFilter.__init__", "modulename": "tksbrokerapi.UniLogger", "qualname": "LevelFilter.__init__", "kind": "function", "doc": "Initialize a filter.
\n\nInitialize with the name of the logger which, together with its\nchildren, will have its events allowed through the filter. If no\nname is specified, allow every event.
\n", "signature": "(level)"}, {"fullname": "tksbrokerapi.UniLogger.LevelFilter.filter", "modulename": "tksbrokerapi.UniLogger", "qualname": "LevelFilter.filter", "kind": "function", "doc": "Determine if the specified record is to be logged.
\n\nReturns True if the record should be logged, or False otherwise.\nIf deemed appropriate, the record may be modified in-place.
\n", "signature": "(self, record):", "funcdef": "def"}, {"fullname": "tksbrokerapi.UniLogger.EnableLogger", "modulename": "tksbrokerapi.UniLogger", "qualname": "EnableLogger", "kind": "function", "doc": "Adding new file logger with rotation.
\n", "signature": "(\tlogFile,\tparentHandler=<Logger TKSBrokerAPI-UniLogger (DEBUG)>,\tuseFormat=<logging.Formatter object>):", "funcdef": "def"}, {"fullname": "tksbrokerapi.UniLogger.DisableLogger", "modulename": "tksbrokerapi.UniLogger", "qualname": "DisableLogger", "kind": "function", "doc": "Disable given file logger.
\n", "signature": "(handler, parentHandler=<Logger TKSBrokerAPI-UniLogger (DEBUG)>):", "funcdef": "def"}]; // mirrored in build-search-index.js (part 1) // Also split on html tags. this is a cheap heuristic, but good enough. diff --git a/docs/tksbrokerapi/TradeRoutines.html b/docs/tksbrokerapi/TradeRoutines.html index 68ff03e..c4f8c56 100644 --- a/docs/tksbrokerapi/TradeRoutines.html +++ b/docs/tksbrokerapi/TradeRoutines.html @@ -42,6 +42,9 @@169def SeparateByEqualParts(elements: list, parts: int = 2, union: bool = True) -> list: +170 """ +171 Gets input list and try to separate it by equal parts of elements. +172 +173 Examples: +174 SeparateByEqualParts(elements=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], parts=2) -> [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]] +175 SeparateByEqualParts(elements=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], parts=2, union=True) -> [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9, 10]] +176 SeparateByEqualParts(elements=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], parts=2, union=False) -> [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [10]]] +177 SeparateByEqualParts(elements=[1, 2, 3], parts=2, union=True) -> [[1], [2, 3]] +178 SeparateByEqualParts(elements=[1, 2, 3], parts=2, union=False) -> [[1], [2], [3]] +179 +180 If parts > length of elements: +181 SeparateByEqualParts(elements=[1], parts=2, union=True) -> [[1]] +182 SeparateByEqualParts(elements=[1, 2, 3], parts=4, union=True) -> [[1], [2], [3]] +183 SeparateByEqualParts(elements=[1], parts=2, union=False) -> [[1], []] +184 SeparateByEqualParts(elements=[1, 2, 3], parts=4, union=False) -> [[1], [2], [3], []] +185 +186 :param elements: list of objects. +187 :param parts: int, numbers of equal parts of objects. +188 :param union: bool, if True and if the remainder of the separating not empty, then remainder part union with the last part. +189 :return: list of lists with equal parts of objects. +190 """ +191 try: +192 result = [] +193 if elements is not None and isinstance(elements, list) and elements and isinstance(parts, int) and isinstance(union, bool): +194 count = len(elements) +195 +196 if parts == 1: +197 result = [elements] +198 +199 elif parts > count: +200 result = [[item] for item in elements] +201 +202 if not union: +203 result.extend([[] for _ in range(parts - count)]) +204 +205 else: +206 partsLen = count // parts +207 for part in range(parts): +208 result.append(elements[part * partsLen: (part + 1) * partsLen]) +209 +210 index = parts * partsLen +211 if index < count: +212 if union: +213 result[-1].extend(elements[index:]) +214 +215 else: +216 result.append(elements[index:]) +217 +218 return result +219 +220 except Exception: +221 return [] +
Gets input list and try to separate it by equal parts of elements.
+ +Examples: +SeparateByEqualParts(elements=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], parts=2) -> [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]] +SeparateByEqualParts(elements=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], parts=2, union=True) -> [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9, 10]] +SeparateByEqualParts(elements=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], parts=2, union=False) -> [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [10]]] +SeparateByEqualParts(elements=[1, 2, 3], parts=2, union=True) -> [[1], [2, 3]] +SeparateByEqualParts(elements=[1, 2, 3], parts=2, union=False) -> [[1], [2], [3]]
+ +If parts > length of elements: +SeparateByEqualParts(elements=[1], parts=2, union=True) -> [[1]] +SeparateByEqualParts(elements=[1, 2, 3], parts=4, union=True) -> [[1], [2], [3]] +SeparateByEqualParts(elements=[1], parts=2, union=False) -> [[1], []] +SeparateByEqualParts(elements=[1, 2, 3], parts=4, union=False) -> [[1], [2], [3], []]
+ +++list of lists with equal parts of objects.
+