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;u0&&t.push(e);for(var i in n)"docs"!==i&&"df"!==i&&this.expandToken(e+i,t,n[i]);return t},t.InvertedIndex.prototype.toJSON=function(){return{root:this.root}},t.Configuration=function(e,n){var e=e||"";if(void 0==n||null==n)throw new Error("fields should not be null");this.config={};var i;try{i=JSON.parse(e),this.buildUserConfig(i,n)}catch(o){t.utils.warn("user configuration parse failed, will use default configuration"),this.buildDefaultConfig(n)}},t.Configuration.prototype.buildDefaultConfig=function(e){this.reset(),e.forEach(function(e){this.config[e]={boost:1,bool:"OR",expand:!1}},this)},t.Configuration.prototype.buildUserConfig=function(e,n){var i="OR",o=!1;if(this.reset(),"bool"in e&&(i=e.bool||i),"expand"in e&&(o=e.expand||o),"fields"in e)for(var r in e.fields)if(n.indexOf(r)>-1){var s=e.fields[r],u=o;void 0!=s.expand&&(u=s.expand),this.config[r]={boost:s.boost||0===s.boost?s.boost:1,bool:s.bool||i,expand:u}}else t.utils.warn("field name in user configuration not found in index instance fields");else this.addAllFields2UserConfig(i,o,n)},t.Configuration.prototype.addAllFields2UserConfig=function(e,t,n){n.forEach(function(n){this.config[n]={boost:1,bool:e,expand:t}},this)},t.Configuration.prototype.get=function(){return this.config},t.Configuration.prototype.reset=function(){this.config={}},lunr.SortedSet=function(){this.length=0,this.elements=[]},lunr.SortedSet.load=function(e){var t=new this;return t.elements=e,t.length=e.length,t},lunr.SortedSet.prototype.add=function(){var e,t;for(e=0;e1;){if(r===e)return o;e>r&&(t=o),r>e&&(n=o),i=n-t,o=t+Math.floor(i/2),r=this.elements[o]}return r===e?o:-1},lunr.SortedSet.prototype.locationFor=function(e){for(var t=0,n=this.elements.length,i=n-t,o=t+Math.floor(i/2),r=this.elements[o];i>1;)e>r&&(t=o),r>e&&(n=o),i=n-t,o=t+Math.floor(i/2),r=this.elements[o];return r>e?o:e>r?o+1:void 0},lunr.SortedSet.prototype.intersect=function(e){for(var t=new lunr.SortedSet,n=0,i=0,o=this.length,r=e.length,s=this.elements,u=e.elements;;){if(n>o-1||i>r-1)break;s[n]!==u[i]?s[n]u[i]&&i++:(t.add(s[n]),n++,i++)}return t},lunr.SortedSet.prototype.clone=function(){var e=new lunr.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},lunr.SortedSet.prototype.union=function(e){var t,n,i;this.length>=e.length?(t=this,n=e):(t=e,n=this),i=t.clone();for(var o=0,r=n.toArray();o

\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.

\n\n

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\n\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer", "kind": "class", "doc": "

This class implements methods to work with Tinkoff broker server.

\n\n

Examples to work with API: https://tinkoff.github.io/investAPI/swagger-ui/

\n\n

About token: https://tinkoff.github.io/investAPI/token/

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.__init__", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.__init__", "kind": "function", "doc": "

Main class init.

\n\n
Parameters
\n\n
    \n
  • token: Bearer token for Tinkoff Invest API. It can be set from environment variable TKS_API_TOKEN.
  • \n
  • accountId: string with numeric user account ID in Tinkoff Broker. It can be found in broker's reports.\nAlso, this variable can be set from environment variable TKS_ACCOUNT_ID.
  • \n
  • useCache: use default cache file with raw data to use instead of 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.
  • \n
  • defaultCache: path to default cache file. dump.json by default.
  • \n
\n", "signature": "(\ttoken: str,\taccountId: str = None,\tuseCache: bool = True,\tdefaultCache: str = 'dump.json')"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.version", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.version", "kind": "variable", "doc": "

Current TKSBrokerAPI version: major.minor, but the build number define at the build-server only.

\n\n

Latest 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\n

See also: TKSEnums.TKS_TICKER_ALIASES

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.depth", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.depth", "kind": "variable", "doc": "

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.

\n\n

See also: GetCurrentPrices().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.server", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.server", "kind": "variable", "doc": "

Tinkoff REST API server for real trade operations. Default: https://invest-public-api.tinkoff.ru/rest

\n\n

See also: API method https://tinkoff.github.io/investAPI/#tinkoff-invest-api_1 and SendAPIRequest().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.timeout", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.timeout", "kind": "variable", "doc": "

Server operations timeout in seconds. Default: 15.

\n\n

See also: SendAPIRequest().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.headers", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.headers", "kind": "variable", "doc": "

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}\"}.

\n\n

See also: SendAPIRequest().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.body", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.body", "kind": "variable", "doc": "

Request body which send to broker server. Default: None.

\n\n

See also: SendAPIRequest().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.moreDebug", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.moreDebug", "kind": "variable", "doc": "

Enables more debug information in this class, such as net request and response headers in all methods. False by default.

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.useHTMLReports", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.useHTMLReports", "kind": "variable", "doc": "

If True then TKSBrokerAPI generate also HTML reports from Markdown. False by default.

\n\n

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.

\n\n

See also: History().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.htmlHistoryFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.htmlHistoryFile", "kind": "variable", "doc": "

Full path to the html file where rendered candles chart stored. Default: index.html.

\n\n

See also: ShowHistoryChart().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.instrumentsFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.instrumentsFile", "kind": "variable", "doc": "

Filename where full available to user instruments list will be saved. Default: instruments.md.

\n\n

See also: ShowInstrumentsInfo().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.searchResultsFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.searchResultsFile", "kind": "variable", "doc": "

Filename with all found instruments searched by part of its ticker, FIGI or name. Default: search-results.md.

\n\n

See also: SearchInstruments().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.pricesFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.pricesFile", "kind": "variable", "doc": "

Filename where prices of selected instruments will be saved. Default: prices.md.

\n\n

See also: GetListOfPrices().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.infoFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.infoFile", "kind": "variable", "doc": "

Filename where prices of selected instruments will be saved. Default: prices.md.

\n\n

See also: ShowInstrumentsInfo(), RequestBondCoupons() and RequestTradingStatus().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.bondsXLSXFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.bondsXLSXFile", "kind": "variable", "doc": "

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.

\n\n

See also: ExtendBondsData().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.calendarFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.calendarFile", "kind": "variable", "doc": "

Filename where bonds payment calendar will be saved. Default: calendar.md.

\n\n

Pandas dataframe with only bonds payment calendar also will be stored to default file calendar.xlsx.

\n\n

See also: CreateBondsCalendar(), ShowBondsCalendar(), ShowInstrumentInfo(), RequestBondCoupons() and ExtendBondsData().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.overviewFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.overviewFile", "kind": "variable", "doc": "

Filename where current portfolio, open trades and orders will be saved. Default: overview.md.

\n\n

See also: Overview(), RequestPortfolio(), RequestPositions(), RequestPendingOrders() and RequestStopOrders().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.overviewDigestFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.overviewDigestFile", "kind": "variable", "doc": "

Filename where short digest of the portfolio status will be saved. Default: overview-digest.md.

\n\n

See also: Overview() with parameter details=\"digest\".

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.overviewPositionsFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.overviewPositionsFile", "kind": "variable", "doc": "

Filename where only open positions, without everything else will be saved. Default: overview-positions.md.

\n\n

See also: Overview() with parameter details=\"positions\".

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.overviewOrdersFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.overviewOrdersFile", "kind": "variable", "doc": "

Filename where open limits and stop orders will be saved. Default: overview-orders.md.

\n\n

See also: Overview() with parameter details=\"orders\".

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.overviewAnalyticsFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.overviewAnalyticsFile", "kind": "variable", "doc": "

Filename where only the analytics section and the distribution of the portfolio by various categories will be saved. Default: overview-analytics.md.

\n\n

See also: Overview() with parameter details=\"analytics\".

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.overviewBondsCalendarFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.overviewBondsCalendarFile", "kind": "variable", "doc": "

Filename where only the bonds calendar section will be saved. Default: overview-calendar.md.

\n\n

See also: Overview() with parameter details=\"calendar\".

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.reportFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.reportFile", "kind": "variable", "doc": "

Filename where history of deals and trade statistics will be saved. Default: deals.md.

\n\n

See also: Deals().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.withdrawalLimitsFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.withdrawalLimitsFile", "kind": "variable", "doc": "

Filename where table of funds available for withdrawal will be saved. Default: limits.md.

\n\n

See also: OverviewLimits() and RequestLimits().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.userInfoFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.userInfoFile", "kind": "variable", "doc": "

Filename where all available user's data (accountIds, common user information, margin status and tariff connections limit) will be saved. Default: user-info.md.

\n\n

See also: OverviewUserInfo(), RequestAccounts(), RequestUserInfo(), RequestMarginStatus() and RequestTariffLimits().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.userAccountsFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.userAccountsFile", "kind": "variable", "doc": "

Filename where simple table with all available user accounts (accountIds) will be saved. Default: accounts.md.

\n\n

See also: OverviewAccounts(), RequestAccounts().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.iListDumpFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.iListDumpFile", "kind": "variable", "doc": "

Filename where raw data about shares, currencies, bonds, etfs and futures will be stored. Default: dump.json.

\n\n

Pandas dataframe with raw instruments data also will be stored to default file dump.xlsx.

\n\n

See also: DumpInstruments() and DumpInstrumentsAsXLSX().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.iList", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.iList", "kind": "variable", "doc": "

Dictionary with raw data about shares, currencies, bonds, etfs and futures from broker server. Auto-updating and saving dump to the iListDumpFile.

\n\n

See also: Listing(), DumpInstruments().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.priceModel", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.priceModel", "kind": "variable", "doc": "

PriceGenerator object to work with candles data: load, render interact and non-interact charts and so on.

\n\n

See also: LoadHistory(), ShowHistoryChart() and the PriceGenerator project: https://github.com/Tim55667757/PriceGenerator

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.ticker", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.ticker", "kind": "variable", "doc": "

Setter for string with ticker, e.g. GOOGL. Tickers may be upper case only.

\n\n

Use alias for USD000UTSTOM simple as USD, EUR_RUB__TOM as EUR etc.\nMore tickers aliases here: TKSEnums.TKS_TICKER_ALIASES.

\n\n

See also: SearchByTicker(), SearchInstruments().

\n", "annotation": ": str"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.figi", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.figi", "kind": "variable", "doc": "

Setter for string with FIGI, e.g. ticker GOOGL has FIGI BBG009S39JX6. FIGIs may be upper case only.

\n\n

See also: SearchByFIGI(), SearchInstruments().

\n", "annotation": ": str"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.SendAPIRequest", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.SendAPIRequest", "kind": "function", "doc": "

Send GET or POST request to broker server and receive JSON object.

\n\n

self.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
Parameters
\n\n
    \n
  • url: url with REST request.
  • \n
  • reqType: send \"GET\" or \"POST\" request. \"GET\" by default.
  • \n
  • retry: how many times retry after first request if an 5xx server errors occurred.
  • \n
  • pause: sleep time in seconds between retries.
  • \n
\n\n
Returns
\n\n
\n

response JSON (dictionary) from broker.

\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": "

Gets JSON with raw data about shares, currencies, bonds, etfs and futures from broker server.

\n\n
Returns
\n\n
\n

Dictionary with all available broker instruments: currencies, shares, bonds, etfs and futures.

\n
\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.DumpInstrumentsAsXLSX", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.DumpInstrumentsAsXLSX", "kind": "function", "doc": "

Creates XLSX-formatted dump file with raw data of instruments to further used by data scientists or stock analytics.

\n\n

See also: DumpInstruments(), Listing().

\n\n
Parameters
\n\n
    \n
  • forceUpdate: if True then at first updates data with Listing() method,\notherwise just saves exist iList as XLSX-file (default: dump.xlsx) .
  • \n
\n", "signature": "(self, forceUpdate: bool = False) -> None:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.DumpInstruments", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.DumpInstruments", "kind": "function", "doc": "

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.

\n\n

See also: DumpInstrumentsAsXLSX(), Listing().

\n\n
Parameters
\n\n
    \n
  • forceUpdate: if True then at first updates data with Listing() method,\notherwise just saves exist iList as JSON-file (default: dump.json).
  • \n
\n\n
Returns
\n\n
\n

serialized JSON formatted str with full data of instruments, also saved to the --output JSON-file.

\n
\n", "signature": "(self, forceUpdate: bool = True) -> str:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.ShowInstrumentInfo", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.ShowInstrumentInfo", "kind": "function", "doc": "

Show information about one instrument defined by json data and prints it in Markdown format.

\n\n

See also: SearchByTicker(), SearchByFIGI(), RequestBondCoupons(), ExtendBondsData(), ShowBondsCalendar() and RequestTradingStatus().

\n\n
Parameters
\n\n
    \n
  • iJSON: json data of instrument, example: iJSON = self.iList[\"Shares\"][self._ticker]
  • \n
  • show: if True then also printing information about instrument and its current price.
  • \n
\n\n
Returns
\n\n
\n

multilines text in Markdown format with information about one instrument.

\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": "

Search and return raw broker's information about instrument by its ticker. Variable ticker must be defined!

\n\n
Parameters
\n\n
    \n
  • requestPrice: if False then do not request current price of instrument (because this is long operation).
  • \n
  • show: if False then do not run ShowInstrumentInfo() method and do not print info to the console.
  • \n
\n\n
Returns
\n\n
\n

JSON formatted data with information about instrument.

\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": "

Search and return raw broker's information about instrument by its FIGI. Variable figi must be defined!

\n\n
Parameters
\n\n
    \n
  • requestPrice: if False then do not request current price of instrument (it's long operation).
  • \n
  • show: if False then do not run ShowInstrumentInfo() method and do not print info to the console.
  • \n
\n\n
Returns
\n\n
\n

JSON formatted data with information about instrument.

\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": "

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:

\n\n
    \n
  • buy: list of dicts with Sellers prices, see also: https://tinkoff.github.io/investAPI/marketdata/#order
  • \n
  • sell: list of dicts with Buyers prices,\n
      \n
    • price: price of 1 instrument (to get the cost of the lot, you need to multiply it by the lot of size of the instrument),
    • \n
    • quantity: volume value by current price in lots,
    • \n
  • \n
  • limitUp: current trade session limit price, maximum,
  • \n
  • limitDown: current trade session limit price, minimum,
  • \n
  • lastPrice: last deal price of the instrument,
  • \n
  • closePrice: previous trade session close price of the instrument.
  • \n
\n\n

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

\n\n
Parameters
\n\n
    \n
  • show: if True then print DOM to log and console.
  • \n
\n\n
Returns
\n\n
\n

orders book dict with lists of current buy and sell prices: {\"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}.

\n
\n", "signature": "(self, show: bool = True) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.ShowInstrumentsInfo", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.ShowInstrumentsInfo", "kind": "function", "doc": "

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.

\n\n
Parameters
\n\n
    \n
  • show: if True then print results to console, if False \u2014 print only to file.
  • \n
\n\n
Returns
\n\n
\n

multi-lines string with all available broker instruments

\n
\n", "signature": "(self, show: bool = True) -> str:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.SearchInstruments", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.SearchInstruments", "kind": "function", "doc": "

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.

\n\n
Parameters
\n\n
    \n
  • pattern: string with part of ticker, FIGI or instrument's name.
  • \n
  • show: if True then print results to console, if False \u2014 return list of result only.
  • \n
\n\n
Returns
\n\n
\n

list of dictionaries with all found instruments.

\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": "

Creating list with unique instrument FIGIs from input list of tickers (priority) or FIGIs.

\n\n
Parameters
\n\n
    \n
  • instruments: list of strings with tickers or FIGIs.
  • \n
\n\n
Returns
\n\n
\n

list with unique instrument FIGIs only.

\n
\n", "signature": "(self, instruments: list[str]) -> list:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.GetListOfPrices", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.GetListOfPrices", "kind": "function", "doc": "

This method get, maybe show and return prices of list of instruments. WARNING! This is potential long operation!

\n\n

See limits: https://tinkoff.github.io/investAPI/limits/

\n\n

If pricesFile string is not empty then also save information to this file.

\n\n
Parameters
\n\n
    \n
  • instruments: list of strings with tickers or FIGIs.
  • \n
  • show: if True then prints prices to console, if False \u2014 prints only to file pricesFile.
  • \n
\n\n
Returns
\n\n
\n

list of instruments looks like [{some ticker info, \"currentPrice\": {current prices}}, {...}, ...].\n One item is dict returned by SearchByTicker() or SearchByFIGI() methods.

\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": "

Show table contains current prices of given instruments.

\n\n
Parameters
\n\n
    \n
  • **iList: list of instruments looks like [{some ticker info, \"currentPrice\"**: {current prices}}, {...}, ...].\nOne item is dict returned by SearchByTicker(requestPrice=True) or by SearchByFIGI(requestPrice=True) methods.
  • \n
  • show: if True then prints prices to console, if False \u2014 prints only to file pricesFile.
  • \n
\n\n
Returns
\n\n
\n

multilines text in Markdown format as a table contains current prices.

\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": "

Requesting trading status for the instrument defined by figi variable.

\n\n

REST API: https://tinkoff.github.io/investAPI/swagger-ui/#/MarketDataService/MarketDataService_GetTradingStatus

\n\n

Documentation: https://tinkoff.github.io/investAPI/marketdata/#gettradingstatusrequest

\n\n
Returns
\n\n
\n

dictionary with trading status attributes. Response example:\n {\"figi\": \"TCS00A103X66\", \"tradingStatus\": \"SECURITY_TRADING_STATUS_NOT_AVAILABLE_FOR_TRADING\",\n \"limitOrderAvailableFlag\": false, \"marketOrderAvailableFlag\": false, \"apiTradeAvailableFlag\": true}

\n
\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestPortfolio", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestPortfolio", "kind": "function", "doc": "

Requesting actual user's portfolio for current accountId.

\n\n

REST API for user portfolio: https://tinkoff.github.io/investAPI/swagger-ui/#/OperationsService/OperationsService_GetPortfolio

\n\n

Documentation: https://tinkoff.github.io/investAPI/operations/#portfoliorequest

\n\n
Returns
\n\n
\n

dictionary with user's portfolio.

\n
\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestPositions", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestPositions", "kind": "function", "doc": "

Requesting open positions by currencies and instruments for current accountId.

\n\n

REST API for open positions: https://tinkoff.github.io/investAPI/swagger-ui/#/OperationsService/OperationsService_GetPositions

\n\n

Documentation: https://tinkoff.github.io/investAPI/operations/#positionsrequest

\n\n
Returns
\n\n
\n

dictionary with open positions by instruments.

\n
\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestPendingOrders", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestPendingOrders", "kind": "function", "doc": "

Requesting current actual pending limit orders for current accountId.

\n\n

REST API for pending (market) orders: https://tinkoff.github.io/investAPI/swagger-ui/#/OrdersService/OrdersService_GetOrders

\n\n

Documentation: https://tinkoff.github.io/investAPI/orders/#getordersrequest

\n\n
Returns
\n\n
\n

list of dictionaries with pending limit orders.

\n
\n", "signature": "(self) -> list:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestStopOrders", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestStopOrders", "kind": "function", "doc": "

Requesting current actual stop orders for current accountId.

\n\n

REST API for opened stop-orders: https://tinkoff.github.io/investAPI/swagger-ui/#/StopOrdersService/StopOrdersService_GetStopOrders

\n\n

Documentation: https://tinkoff.github.io/investAPI/stoporders/#getstopordersrequest

\n\n
Returns
\n\n
\n

list of dictionaries with stop orders.

\n
\n", "signature": "(self) -> list:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.Overview", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.Overview", "kind": "function", "doc": "

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.

\n\n

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\n
Parameters
\n\n
    \n
  • show: if False then only dictionary returns, if True then show more debug information.
  • \n
  • details: how detailed should the information be?\n
      \n
    • full \u2014 shows full available information about portfolio status (by default),
    • \n
    • positions \u2014 shows only open positions,
    • \n
    • orders \u2014 shows only sections of open limits and stop orders.
    • \n
    • digest \u2014 show a short digest of the portfolio status,
    • \n
    • analytics \u2014 shows only the analytics section and the distribution of the portfolio by various categories,
    • \n
    • calendar \u2014 shows only the bonds calendar section (if these present in portfolio),
    • \n
  • \n
\n\n
Returns
\n\n
\n

dictionary with client's raw portfolio and some statistics.

\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": "

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.

\n\n
Parameters
\n\n
    \n
  • start: see docstring in TradeRoutines.GetDatesAsString() method.
  • \n
  • end: see docstring in TradeRoutines.GetDatesAsString() method.
  • \n
  • show: if True then also prints all records to the console.
  • \n
  • showCancelled: if False then remove information about cancelled operations from the deals report.
  • \n
\n\n
Returns
\n\n
\n

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
\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": "

This method returns last history candles of the current instrument defined by ticker or figi (FIGI id).

\n\n

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.

\n\n

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.

\n\n

See also: LoadHistory() and ShowHistoryChart() methods.

\n\n
Parameters
\n\n
    \n
  • start: see docstring in TradeRoutines.GetDatesAsString() method.
  • \n
  • end: see docstring in TradeRoutines.GetDatesAsString() method.
  • \n
  • interval: this is a candle interval. Current available values are \"1min\", \"5min\", \"15min\",\n\"hour\", \"day\". Default: \"hour\".
  • \n
  • onlyMissing: if 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!
  • \n
  • csvSep: separator if csv-file is used, , by default.
  • \n
  • show: if True then also prints Pandas DataFrame to the console.
  • \n
\n\n
Returns
\n\n
\n

Pandas DataFrame with prices history. Headers of columns are defined by default:\n [\"date\", \"time\", \"open\", \"high\", \"low\", \"close\", \"volume\"].

\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": "

Load candles history from csv-file and return Pandas DataFrame object.

\n\n

See also: History() and ShowHistoryChart() methods.

\n\n
Parameters
\n\n
    \n
  • filePath: path to csv-file to open.
  • \n
\n", "signature": "(self, filePath: str) -> pandas.core.frame.DataFrame:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.ShowHistoryChart", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.ShowHistoryChart", "kind": "function", "doc": "

Render an HTML-file with interact or non-interact candlesticks chart. Candles may be path to the csv-file.

\n\n

Self 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).

\n\n

See also: History() and LoadHistory() methods.

\n\n
Parameters
\n\n\n", "signature": "(\tself,\tcandles: Union[str, pandas.core.frame.DataFrame] = None,\tinteract: bool = True,\topenInBrowser: bool = False) -> None:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.Trade", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.Trade", "kind": "function", "doc": "

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.

\n\n

See also: Order() docstring. More simple methods than Trade() are Buy() and Sell().

\n\n
Parameters
\n\n
    \n
  • operation: string \"Buy\" or \"Sell\".
  • \n
  • lots: volume, integer count of lots >= 1.
  • \n
  • tp: float > 0, target price for stop-order with \"TP\" type. It used as take profit parameter targetPrice in self.Order().
  • \n
  • sl: float > 0, target price for stop-order with \"SL\" type. It used as stop loss parameter targetPrice in self.Order().
  • \n
  • expDate: string \"Undefined\" by default or local date in future,\nit is a string with format %Y-%m-%d %H:%M:%S.
  • \n
\n\n
Returns
\n\n
\n

JSON with response from broker server.

\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": "

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.

\n\n

See also: Order() and Trade() docstrings.

\n\n
Parameters
\n\n
    \n
  • lots: volume, integer count of lots >= 1.
  • \n
  • tp: float > 0, take profit price of stop-order.
  • \n
  • sl: float > 0, stop loss price of stop-order.
  • \n
  • expDate: it's a local date in future.\nString has a format like this: %Y-%m-%d %H:%M:%S.
  • \n
\n\n
Returns
\n\n
\n

JSON with response from broker server.

\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": "

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.

\n\n

See also: Order() and Trade() docstrings.

\n\n
Parameters
\n\n
    \n
  • lots: volume, integer count of lots >= 1.
  • \n
  • tp: float > 0, take profit price of stop-order.
  • \n
  • sl: float > 0, stop loss price of stop-order.
  • \n
  • expDate: it's a local date in the future.\nString has a format like this: %Y-%m-%d %H:%M:%S.
  • \n
\n\n
Returns
\n\n
\n

JSON with response from broker server.

\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": "

Close position of given instruments.

\n\n
Parameters
\n\n
    \n
  • instruments: list of instruments defined by tickers or FIGIs that must be closed.
  • \n
  • portfolio: pre-received dictionary with open trades, returned by Overview() method.\nThis avoids unnecessary downloading data from the server.
  • \n
\n", "signature": "(self, instruments: list[str], portfolio: dict = None) -> None:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.CloseAllTrades", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.CloseAllTrades", "kind": "function", "doc": "

Close all positions of given instruments with defined type.

\n\n
Parameters
\n\n
    \n
  • iType: type of the instruments that be closed, it must be one of supported types in TKS_INSTRUMENTS list.
  • \n
  • portfolio: pre-received dictionary with open trades, returned by Overview() method.\nThis avoids unnecessary downloading data from the server.
  • \n
\n", "signature": "(self, iType: str, portfolio: dict = None) -> None:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.Order", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.Order", "kind": "function", "doc": "

Universal method to create market or limit orders with all available parameters for current accountId.\nSee more simple methods: BuyLimit(), BuyStop(), SellLimit(), SellStop().

\n\n

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\n

Warning! 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\n

If 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\n

Only one attempt and no retry for opens order. If network issue occurred you can create new request.

\n\n
Parameters
\n\n
    \n
  • operation: string \"Buy\" or \"Sell\".
  • \n
  • orderType: string \"Limit\" or \"Stop\".
  • \n
  • lots: volume, integer count of lots >= 1.
  • \n
  • targetPrice: target price > 0. This is open trade price for limit order.
  • \n
  • limitPrice: limit price >= 0. This parameter only makes sense for stop-order. If limitPrice = 0, then it set as targetPrice.\nBroker will creates limit-order with price equal to limitPrice, when current price goes to target price of stop-order.
  • \n
  • stopType: string \"Limit\" by default. This parameter only makes sense for stop-order. There are 3 stop-order types\n\"SL\", \"TP\", \"Limit\" for \"Stop loss\", \"Take profit\" and \"Stop limit\" types accordingly.\nStop loss order always executed by market price.
  • \n
  • expDate: string \"Undefined\" by default or local date in future.\nString has a format like this: %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\n
Returns
\n\n
\n

JSON with response from broker server.

\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": "

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
Parameters
\n\n
    \n
  • lots: volume, integer count of lots >= 1.
  • \n
  • targetPrice: target price > 0. This is open trade price for limit order.
  • \n
\n\n
Returns
\n\n
\n

JSON with response from broker server.

\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": "

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.

\n\n
Parameters
\n\n
    \n
  • lots: volume, integer count of lots >= 1.
  • \n
  • targetPrice: target price > 0. This is trigger price for buy stop-order.
  • \n
  • limitPrice: limit price >= 0 (limitPrice = targetPrice if limitPrice is 0). Broker will creates limit-order\nwith price equal to limitPrice, when current price goes to target price of buy stop-order.
  • \n
  • stopType: string \"Limit\" by default. There are 3 stop-order types \"SL\", \"TP\", \"Limit\"\nfor \"Stop loss\", \"Take profit\" and \"Stop limit\" types accordingly.
  • \n
  • expDate: string \"Undefined\" by default or local date in future.\nString has a format like this: %Y-%m-%d %H:%M:%S.\nThis date is converting to UTC format for server.
  • \n
\n\n
Returns
\n\n
\n

JSON with response from broker 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": "

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
Parameters
\n\n
    \n
  • lots: volume, integer count of lots >= 1.
  • \n
  • targetPrice: target price > 0. This is open trade price for limit order.
  • \n
\n\n
Returns
\n\n
\n

JSON with response from broker server.

\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": "

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.

\n\n
Parameters
\n\n
    \n
  • lots: volume, integer count of lots >= 1.
  • \n
  • targetPrice: target price > 0. This is trigger price for sell stop-order.
  • \n
  • limitPrice: limit price >= 0 (limitPrice = targetPrice if limitPrice is 0). Broker will creates limit-order\nwith price equal to limitPrice, when current price goes to target price of sell stop-order.
  • \n
  • stopType: string \"Limit\" by default. There are 3 stop-order types \"SL\", \"TP\", \"Limit\"\nfor \"Stop loss\", \"Take profit\" and \"Stop limit\" types accordingly.
  • \n
  • expDate: string \"Undefined\" by default or local date in future.\nString has a format like this: %Y-%m-%d %H:%M:%S.\nThis date is converting to UTC format for server.
  • \n
\n\n
Returns
\n\n
\n

JSON with response from broker 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": "

Cancel order or list of orders by its orderId or stopOrderId for current accountId.

\n\n
Parameters
\n\n
    \n
  • orderIDs: list of integers with orderId or stopOrderId.
  • \n
  • allOrdersIDs: pre-received lists of all active pending limit orders.\nThis avoids unnecessary downloading data from the server.
  • \n
  • allStopOrdersIDs: pre-received lists of all active stop orders.
  • \n
\n", "signature": "(\tself,\torderIDs: list,\tallOrdersIDs: list = None,\tallStopOrdersIDs: list = None) -> None:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.CloseAllOrders", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.CloseAllOrders", "kind": "function", "doc": "

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\n

Also, you can select one or more keywords case-insensitive:\norders, shares, bonds, etfs and futures from TKS_INSTRUMENTS enum to specify trades type.

\n\n

Currency positions you must close manually using buy or sell operations, CloseTrades() or CloseAllTrades() methods.

\n", "signature": "(self, *args) -> None:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.CloseAllByTicker", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.CloseAllByTicker", "kind": "function", "doc": "

Close all available (not blocked) opened trades and orders for one instrument defined by its ticker.

\n\n

This 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.

\n\n

See also: IsInLimitOrders(), GetLimitOrderIDs(), IsInStopOrders(), GetStopOrderIDs(), CloseTrades() and CloseOrders().

\n\n
Parameters
\n\n
    \n
  • instrument: string with ticker.
  • \n
\n", "signature": "(self, instrument: str) -> None:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.CloseAllByFIGI", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.CloseAllByFIGI", "kind": "function", "doc": "

Close all available (not blocked) opened trades and orders for one instrument defined by its FIGI id.

\n\n

This 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.

\n\n

See also: IsInLimitOrders(), GetLimitOrderIDs(), IsInStopOrders(), GetStopOrderIDs(), CloseTrades() and CloseOrders().

\n\n
Parameters
\n\n
    \n
  • instrument: string with FIGI id.
  • \n
\n", "signature": "(self, instrument: str) -> None:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.ParseOrderParameters", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.ParseOrderParameters", "kind": "function", "doc": "

Parse input dictionary of strings with order parameters and return dictionary with parameters to open all orders.

\n\n
Parameters
\n\n
    \n
  • operation: string \"Buy\" or \"Sell\".
  • \n
  • inputParameters: this is dict of strings that looks like this\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\n
Returns
\n\n
\n

list of dictionaries with all lots and prices to open orders that looks like this [{\"lot\": lots_1, \"price\": price_1}, {...}, ...]

\n
\n", "signature": "(operation, **inputParameters):", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.IsInPortfolio", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.IsInPortfolio", "kind": "function", "doc": "

Checks if instrument is in the user's portfolio. Instrument must be defined by ticker (highly priority) or figi.

\n\n
Parameters
\n\n
    \n
  • portfolio: dict with user's portfolio data. If None, then requests portfolio from Overview() method.
  • \n
\n\n
Returns
\n\n
\n

True if portfolio contains open position with given instrument, False otherwise.

\n
\n", "signature": "(self, portfolio: dict = None) -> bool:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.GetInstrumentFromPortfolio", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.GetInstrumentFromPortfolio", "kind": "function", "doc": "

Returns instrument from the user's portfolio if it presents there.\nInstrument must be defined by ticker (highly priority) or figi.

\n\n
Parameters
\n\n
    \n
  • portfolio: dict with user's portfolio data. If None, then requests portfolio from Overview() method.
  • \n
\n\n
Returns
\n\n
\n

dict with instrument if portfolio contains open position with this instrument, None otherwise.

\n
\n", "signature": "(self, portfolio: dict = None) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.IsInLimitOrders", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.IsInLimitOrders", "kind": "function", "doc": "

Checks if instrument is in the limit orders list. Instrument must be defined by ticker (highly priority) or figi.

\n\n

See also: CloseAllByTicker() and CloseAllByFIGI().

\n\n
Parameters
\n\n
    \n
  • portfolio: dict with user's portfolio data. If None, then requests portfolio from Overview() method.
  • \n
\n\n
Returns
\n\n
\n

True if limit orders list contains some limit orders for the instrument, False otherwise.

\n
\n", "signature": "(self, portfolio: dict = None) -> bool:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.GetLimitOrderIDs", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.GetLimitOrderIDs", "kind": "function", "doc": "

Returns list with all orderIDs of opened pending limit orders for the instrument.\nInstrument must be defined by ticker (highly priority) or figi.

\n\n

See also: CloseAllByTicker() and CloseAllByFIGI().

\n\n
Parameters
\n\n
    \n
  • portfolio: dict with user's portfolio data. If None, then requests portfolio from Overview() method.
  • \n
\n\n
Returns
\n\n
\n

list with orderIDs of limit orders.

\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": "

Checks if instrument is in the stop orders list. Instrument must be defined by ticker (highly priority) or figi.

\n\n

See also: CloseAllByTicker() and CloseAllByFIGI().

\n\n
Parameters
\n\n
    \n
  • portfolio: dict with user's portfolio data. If None, then requests portfolio from Overview() method.
  • \n
\n\n
Returns
\n\n
\n

True if stop orders list contains some stop orders for the instrument, False otherwise.

\n
\n", "signature": "(self, portfolio: dict = None) -> bool:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.GetStopOrderIDs", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.GetStopOrderIDs", "kind": "function", "doc": "

Returns list with all orderIDs of opened stop orders for the instrument.\nInstrument must be defined by ticker (highly priority) or figi.

\n\n

See also: CloseAllByTicker() and CloseAllByFIGI().

\n\n
Parameters
\n\n
    \n
  • portfolio: dict with user's portfolio data. If None, then requests portfolio from Overview() method.
  • \n
\n\n
Returns
\n\n
\n

list with orderIDs of stop orders.

\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": "

Method for obtaining the available funds for withdrawal for current accountId.

\n\n

See also:

\n\n\n\n
Returns
\n\n
\n

dict with raw data from server that contains free funds for withdrawal. Example of dict:\n {\"money\": [{\"currency\": \"rub\", \"units\": \"100\", \"nano\": 290000000}, {...}], \"blocked\": [...], \"blockedGuarantee\": [...]}.\n Here money is an array of portfolio currency positions, blocked is an array of blocked currency\n positions of the portfolio and blockedGuarantee is locked money under collateral for futures.

\n
\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.OverviewLimits", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.OverviewLimits", "kind": "function", "doc": "

Method for parsing and show table with available funds for withdrawal for current accountId.

\n\n

See also: RequestLimits().

\n\n
Parameters
\n\n
    \n
  • show: if False then only dictionary returns, if True then also print withdrawal limits to log.
  • \n
\n\n
Returns
\n\n
\n

dict with raw parsed data from server and some calculated statistics about it.

\n
\n", "signature": "(self, show: bool = False) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestAccounts", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestAccounts", "kind": "function", "doc": "

Method for requesting all brokerage accounts (accountIds) of current user detected by token.

\n\n

See also:

\n\n\n\n
Returns
\n\n
\n

dict with raw data from server that contains accounts info. Example of dict:\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 If closedDate=\"1970-01-01T00:00:00Z\" it means that account is active now.

\n
\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestUserInfo", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestUserInfo", "kind": "function", "doc": "

Method for requesting common user's information.

\n\n

See also:

\n\n\n\n
Returns
\n\n
\n

dict with raw data from server that contains user's information. Example of dict:\n {\"premStatus\": true, \"qualStatus\": false, \"qualifiedForWorkWith\": [\"bond\", \"foreign_shares\", \"leverage\",\n \"russian_shares\", \"structured_income_bonds\"], \"tariff\": \"premium\"}.

\n
\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestMarginStatus", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestMarginStatus", "kind": "function", "doc": "

Method for requesting margin calculation for defined account ID.

\n\n

See also:

\n\n\n\n
Parameters
\n\n
    \n
  • accountId: string with numeric account ID. If None, then used class field accountId.
  • \n
\n\n
Returns
\n\n
\n

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: {\"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}}.

\n
\n", "signature": "(self, accountId: str = None) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestTariffLimits", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestTariffLimits", "kind": "function", "doc": "

Method for requesting limits of current tariff (connections, API methods etc.) of current user detected by token.

\n\n

See also:

\n\n\n\n
Returns
\n\n
\n

dict with raw data from server that contains limits of current tariff. Example of dict:\n {\"unaryLimits\": [{\"limitPerMinute\": 0, \"methods\": [\"methods\", \"methods\"]}, ...],\n \"streamLimits\": [{\"streams\": [\"streams\", \"streams\"], \"limit\": 6}, ...]}.

\n
\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestBondCoupons", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestBondCoupons", "kind": "function", "doc": "

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.

\n\n

REST API: https://tinkoff.github.io/investAPI/swagger-ui/#/InstrumentsService/InstrumentsService_GetBondCoupons\nDocumentation:

\n\n\n\n

See also: ExtendBondsData().

\n\n
Parameters
\n\n
    \n
  • iJSON: raw json data of a bond from broker server, example 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\n
Returns
\n\n
\n

dictionary with bond payment calendar. Response example\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}, {...}, ...]}

\n
\n", "signature": "(self, iJSON: dict) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.ExtendBondsData", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.ExtendBondsData", "kind": "function", "doc": "

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\n

WARNING! This is too long operation if a lot of bonds requested from broker server.

\n\n

See also: ShowInstrumentInfo(), CreateBondsCalendar(), ShowBondsCalendar(), RequestBondCoupons().

\n\n
Parameters
\n\n
    \n
  • instruments: list of strings with tickers or FIGIs.
  • \n
  • xlsx: if True then also exports Pandas DataFrame to xlsx-file bondsXLSXFile, default ext-bonds.xlsx,\nfor further used by data scientists or stock analytics.
  • \n
\n\n
Returns
\n\n
\n

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
\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": "

Creates bond payments calendar as Pandas DataFrame, and also save it to the XLSX-file, calendar.xlsx by default.

\n\n

WARNING! This is too long operation if a lot of bonds requested from broker server.

\n\n

See also: ShowBondsCalendar(), ExtendBondsData().

\n\n
Parameters
\n\n
    \n
  • extBonds: Pandas DataFrame object returns by 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().
  • \n
  • xlsx: if True then also exports Pandas DataFrame to file calendarFile + \".xlsx\", calendar.xlsx by default,\nfor further used by data scientists or stock analytics.
  • \n
\n\n
Returns
\n\n
\n

Pandas DataFrame with only bond payments calendar data. Fields mean: https://tinkoff.github.io/investAPI/instruments/#coupon

\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": "

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.

\n\n

See also: ShowInstrumentInfo(), RequestBondCoupons(), CreateBondsCalendar() and ExtendBondsData().

\n\n
Parameters
\n\n
    \n
  • extBonds: Pandas DataFrame object returns by 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().
  • \n
  • show: if True then also printing bonds payment calendar to the console,\notherwise save to file calendarFile only. False by default.
  • \n
\n\n
Returns
\n\n
\n

multilines text in Markdown format with bonds payment calendar as a table.

\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": "

Method for parsing and show simple table with all available user accounts.

\n\n

See also: RequestAccounts() and OverviewUserInfo() methods.

\n\n
Parameters
\n\n
    \n
  • show: if False then only dictionary with accounts data returns, if True then also print it to log.
  • \n
\n\n
Returns
\n\n
\n

dict with parsed accounts data received from RequestAccounts() method. Example of dict:\n view = {\"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\" }, ...}}

\n
\n", "signature": "(self, show: bool = False) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.OverviewUserInfo", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.OverviewUserInfo", "kind": "function", "doc": "

Method for parsing and show all available user's data (accountIds, common user information, margin status and tariff connections limit).

\n\n

See also: OverviewAccounts(), RequestAccounts(), RequestUserInfo(), RequestMarginStatus() and RequestTariffLimits() methods.

\n\n
Parameters
\n\n
    \n
  • show: if False then only dictionary returns, if True then also print user's data to log.
  • \n
\n\n
Returns
\n\n
\n

dict with raw parsed data from server and some calculated statistics about it.

\n
\n", "signature": "(self, show: bool = False) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.Args", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "Args", "kind": "class", "doc": "

If Main() function is imported as module, then this class used to convert arguments from **kwargs as object.

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.Args.__init__", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "Args.__init__", "kind": "function", "doc": "

\n", "signature": "(**kwargs)"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.ParseArgs", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "ParseArgs", "kind": "function", "doc": "

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\n

See examples:

\n\n\n", "signature": "(**kwargs):", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSEnums", "modulename": "tksbrokerapi.TKSEnums", "kind": "module", "doc": "

Module contains a lot of constants from enums sections of Tinkoff Open API documentation used by TKSBrokerAPI module.

\n\n\n"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_DATE_TIME_FORMAT", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_DATE_TIME_FORMAT", "kind": "variable", "doc": "

Date and time string format used by Tinkoff Open API. Default: \"%Y-%m-%dT%H:%M:%SZ\".

\n", "default_value": " = '%Y-%m-%dT%H:%M:%SZ'"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_DATE_TIME_FORMAT_EXT", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_DATE_TIME_FORMAT_EXT", "kind": "variable", "doc": "

Extended date and time string format used by Tinkoff Open API. Default: \"%Y-%m-%dT%H:%M:%S.%fZ\".

\n", "default_value": " = '%Y-%m-%dT%H:%M:%S.%fZ'"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_DATE_FORMAT", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_DATE_FORMAT", "kind": "variable", "doc": "

Date string format for some methods. Default: \"%Y-%m-%d\".

\n", "default_value": " = '%Y-%m-%d'"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_PRINT_DATE_TIME_FORMAT", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_PRINT_DATE_TIME_FORMAT", "kind": "variable", "doc": "

Human-readable format of date and time string. Default: \"%Y-%m-%d %H:%M:%S\".

\n", "default_value": " = '%Y-%m-%d %H:%M:%S'"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_INSTRUMENTS", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_INSTRUMENTS", "kind": "variable", "doc": "

Type of instrument for trade methods must be only one of supported types, listed in this constant. Default: [\"Currencies\", \"Shares\", \"Bonds\", \"Etfs\", \"Futures\"]

\n", "default_value": " = ['Currencies', 'Shares', 'Bonds', 'Etfs', 'Futures']"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_TICKER_ALIASES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_TICKER_ALIASES", "kind": "variable", "doc": "

Some aliases instead official tickers for using in CLI. For example, you can use \"USD\" instead of \"USD000UTSTOM\".

\n", "default_value": " = {'USD': 'USD000UTSTOM', 'EUR': 'EUR_RUB__TOM', 'GBP': 'GBPRUB_TOM', 'CHF': 'CHFRUB_TOM', 'CNY': 'CNYRUB_TOM', 'HKD': 'HKDRUB_TOM', 'TRY': 'TRYRUB_TOM'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_CANDLE_INTERVALS", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_CANDLE_INTERVALS", "kind": "variable", "doc": "

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

\n", "default_value": " = {'Undefined': ['CANDLE_INTERVAL_UNSPECIFIED', 0, 0], '1min': ['CANDLE_INTERVAL_1_MIN', 1, 1438], '5min': ['CANDLE_INTERVAL_5_MIN', 5, 287], '15min': ['CANDLE_INTERVAL_15_MIN', 15, 95], 'hour': ['CANDLE_INTERVAL_HOUR', 60, 167], 'day': ['CANDLE_INTERVAL_DAY', 1440, 364]}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_ACCOUNT_STATUSES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_ACCOUNT_STATUSES", "kind": "variable", "doc": "

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

\n", "default_value": " = {'derivative': 'Futures and Options', 'structured_bonds': 'Structured bonds', 'closed_fund': 'Closed-ended funds', 'bond': 'Bonds with low rating', 'structured_income_bonds': 'Structured income bonds', 'foreign_shares': 'Foreign shares not included in the exchange quotation lists', 'foreign_etf': 'Foreign ETF', 'foreign_bond': 'Euro-bonds', 'russian_shares': 'Russian shares not included in quotation lists', 'leverage': 'Margin trading, unsecured leveraged trades', 'repo': 'REPO agreements'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_TRADING_STATUSES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_TRADING_STATUSES", "kind": "variable", "doc": "

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\n\n"}, {"fullname": "tksbrokerapi.Templates.MAIN_INFO_TEMPLATE", "modulename": "tksbrokerapi.Templates", "qualname": "MAIN_INFO_TEMPLATE", "kind": "variable", "doc": "

This 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\n\n"}, {"fullname": "tksbrokerapi.TradeRoutines.GetDatesAsString", "modulename": "tksbrokerapi.TradeRoutines", "qualname": "GetDatesAsString", "kind": "function", "doc": "

Create tuple of date and time strings with timezone parsed from user-friendly date.

\n\n

Warning! All dates must be in UTC time zone!

\n\n

User dates format must be like: \"%Y-%m-%d\", e.g. \"2020-02-03\" (3 Feb, 2020).

\n\n

Output date is UTC ISO time format by default: \"%Y-%m-%dT%H:%M:%SZ\".

\n\n

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.

\n\n

If start=None, end=None then return dates from yesterday to the end of the day.

\n\n

If start=some_date_1, end=None then return dates from some_date_1 to the end of the day.

\n\n

If start=some_date_1, end=some_date_2 then return dates from start of some_date_1 to end of some_date_2.

\n\n

Start day may be negative integer numbers: -1, -2, -3 \u2014 how many days ago.

\n\n

Also, you can use keywords for start if end=None:

\n\n
    \n
  • today (from 00:00:00 to the end of current day),
  • \n
  • yesterday (-1 day from 00:00:00 to 23:59:59),
  • \n
  • week (-7 day from 00:00:00 to the end of current day),
  • \n
  • month (-30 day from 00:00:00 to the end of current day),
  • \n
  • year (-365 day from 00:00:00 to the end of current day),
  • \n
\n\n
Parameters
\n\n
    \n
  • start: start day in format defined by userFormat or keyword.
  • \n
  • end: end day in format defined by userFormat.
  • \n
  • userFormat: user-friendly date format, e.g. \"%Y-%m-%d\".
  • \n
  • outputFormat: output string date format.
  • \n
\n\n
Returns
\n\n
\n

tuple with 2 strings (\"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.

\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": "

Convert number in nano-view mode with string parameter units and integer parameter nano to float view. Examples:

\n\n

NanoToFloat(units=\"2\", nano=500000000) -> 2.5

\n\n

NanoToFloat(units=\"0\", nano=50000000) -> 0.05

\n\n
Parameters
\n\n
    \n
  • units: integer string or integer parameter that represents the integer part of number
  • \n
  • nano: integer string or integer parameter that represents the fractional part of number
  • \n
\n\n
Returns
\n\n
\n

float view of number

\n
\n", "signature": "(units: str, nano: int) -> float:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TradeRoutines.FloatToNano", "modulename": "tksbrokerapi.TradeRoutines", "qualname": "FloatToNano", "kind": "function", "doc": "

Convert float number to nano-type view: dictionary with string units and integer nano parameters {\"units\": \"string\", \"nano\": integer}. Examples:

\n\n

FloatToNano(number=2.5) -> {\"units\": \"2\", \"nano\": 500000000}

\n\n

FloatToNano(number=0.05) -> {\"units\": \"0\", \"nano\": 50000000}

\n\n
Parameters
\n\n
    \n
  • number: float number
  • \n
\n\n
Returns
\n\n
\n

nano-type view of number: {\"units\": \"string\", \"nano\": integer}

\n
\n", "signature": "(number: float) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TradeRoutines.UpdateClassFields", "modulename": "tksbrokerapi.TradeRoutines", "qualname": "UpdateClassFields", "kind": "function", "doc": "

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\"].

\n\n
Parameters
\n\n
    \n
  • instance: instance of class to parametrize.
  • \n
  • **params: dict with all parameters in key**: value format.
  • \n
\n", "signature": "(instance: object, params: dict) -> None:", "funcdef": "def"}, {"fullname": "tksbrokerapi.UniLogger", "modulename": "tksbrokerapi.UniLogger", "kind": "module", "doc": "

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\n

Current internal logger name for TKSBrokerAPI module is TKSBrokerAPI-UniLogger.

\n"}, {"fullname": "tksbrokerapi.UniLogger.SetLevel", "modulename": "tksbrokerapi.UniLogger", "qualname": "SetLevel", "kind": "function", "doc": "

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\n

Initialize 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\n

Returns 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.

\n\n

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\n\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer", "kind": "class", "doc": "

This class implements methods to work with Tinkoff broker server.

\n\n

Examples to work with API: https://tinkoff.github.io/investAPI/swagger-ui/

\n\n

About token: https://tinkoff.github.io/investAPI/token/

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.__init__", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.__init__", "kind": "function", "doc": "

Main class init.

\n\n
Parameters
\n\n
    \n
  • token: Bearer token for Tinkoff Invest API. It can be set from environment variable TKS_API_TOKEN.
  • \n
  • accountId: string with numeric user account ID in Tinkoff Broker. It can be found in broker's reports.\nAlso, this variable can be set from environment variable TKS_ACCOUNT_ID.
  • \n
  • useCache: use default cache file with raw data to use instead of 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.
  • \n
  • defaultCache: path to default cache file. dump.json by default.
  • \n
\n", "signature": "(\ttoken: str,\taccountId: str = None,\tuseCache: bool = True,\tdefaultCache: str = 'dump.json')"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.version", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.version", "kind": "variable", "doc": "

Current TKSBrokerAPI version: major.minor, but the build number define at the build-server only.

\n\n

Latest 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\n

See also: TKSEnums.TKS_TICKER_ALIASES

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.depth", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.depth", "kind": "variable", "doc": "

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.

\n\n

See also: GetCurrentPrices().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.server", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.server", "kind": "variable", "doc": "

Tinkoff REST API server for real trade operations. Default: https://invest-public-api.tinkoff.ru/rest

\n\n

See also: API method https://tinkoff.github.io/investAPI/#tinkoff-invest-api_1 and SendAPIRequest().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.timeout", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.timeout", "kind": "variable", "doc": "

Server operations timeout in seconds. Default: 15.

\n\n

See also: SendAPIRequest().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.headers", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.headers", "kind": "variable", "doc": "

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}\"}.

\n\n

See also: SendAPIRequest().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.body", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.body", "kind": "variable", "doc": "

Request body which send to broker server. Default: None.

\n\n

See also: SendAPIRequest().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.moreDebug", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.moreDebug", "kind": "variable", "doc": "

Enables more debug information in this class, such as net request and response headers in all methods. False by default.

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.useHTMLReports", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.useHTMLReports", "kind": "variable", "doc": "

If True then TKSBrokerAPI generate also HTML reports from Markdown. False by default.

\n\n

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.

\n\n

See also: History().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.htmlHistoryFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.htmlHistoryFile", "kind": "variable", "doc": "

Full path to the html file where rendered candles chart stored. Default: index.html.

\n\n

See also: ShowHistoryChart().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.instrumentsFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.instrumentsFile", "kind": "variable", "doc": "

Filename where full available to user instruments list will be saved. Default: instruments.md.

\n\n

See also: ShowInstrumentsInfo().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.searchResultsFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.searchResultsFile", "kind": "variable", "doc": "

Filename with all found instruments searched by part of its ticker, FIGI or name. Default: search-results.md.

\n\n

See also: SearchInstruments().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.pricesFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.pricesFile", "kind": "variable", "doc": "

Filename where prices of selected instruments will be saved. Default: prices.md.

\n\n

See also: GetListOfPrices().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.infoFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.infoFile", "kind": "variable", "doc": "

Filename where prices of selected instruments will be saved. Default: prices.md.

\n\n

See also: ShowInstrumentsInfo(), RequestBondCoupons() and RequestTradingStatus().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.bondsXLSXFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.bondsXLSXFile", "kind": "variable", "doc": "

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.

\n\n

See also: ExtendBondsData().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.calendarFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.calendarFile", "kind": "variable", "doc": "

Filename where bonds payment calendar will be saved. Default: calendar.md.

\n\n

Pandas dataframe with only bonds payment calendar also will be stored to default file calendar.xlsx.

\n\n

See also: CreateBondsCalendar(), ShowBondsCalendar(), ShowInstrumentInfo(), RequestBondCoupons() and ExtendBondsData().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.overviewFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.overviewFile", "kind": "variable", "doc": "

Filename where current portfolio, open trades and orders will be saved. Default: overview.md.

\n\n

See also: Overview(), RequestPortfolio(), RequestPositions(), RequestPendingOrders() and RequestStopOrders().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.overviewDigestFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.overviewDigestFile", "kind": "variable", "doc": "

Filename where short digest of the portfolio status will be saved. Default: overview-digest.md.

\n\n

See also: Overview() with parameter details=\"digest\".

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.overviewPositionsFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.overviewPositionsFile", "kind": "variable", "doc": "

Filename where only open positions, without everything else will be saved. Default: overview-positions.md.

\n\n

See also: Overview() with parameter details=\"positions\".

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.overviewOrdersFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.overviewOrdersFile", "kind": "variable", "doc": "

Filename where open limits and stop orders will be saved. Default: overview-orders.md.

\n\n

See also: Overview() with parameter details=\"orders\".

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.overviewAnalyticsFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.overviewAnalyticsFile", "kind": "variable", "doc": "

Filename where only the analytics section and the distribution of the portfolio by various categories will be saved. Default: overview-analytics.md.

\n\n

See also: Overview() with parameter details=\"analytics\".

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.overviewBondsCalendarFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.overviewBondsCalendarFile", "kind": "variable", "doc": "

Filename where only the bonds calendar section will be saved. Default: overview-calendar.md.

\n\n

See also: Overview() with parameter details=\"calendar\".

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.reportFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.reportFile", "kind": "variable", "doc": "

Filename where history of deals and trade statistics will be saved. Default: deals.md.

\n\n

See also: Deals().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.withdrawalLimitsFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.withdrawalLimitsFile", "kind": "variable", "doc": "

Filename where table of funds available for withdrawal will be saved. Default: limits.md.

\n\n

See also: OverviewLimits() and RequestLimits().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.userInfoFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.userInfoFile", "kind": "variable", "doc": "

Filename where all available user's data (accountIds, common user information, margin status and tariff connections limit) will be saved. Default: user-info.md.

\n\n

See also: OverviewUserInfo(), RequestAccounts(), RequestUserInfo(), RequestMarginStatus() and RequestTariffLimits().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.userAccountsFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.userAccountsFile", "kind": "variable", "doc": "

Filename where simple table with all available user accounts (accountIds) will be saved. Default: accounts.md.

\n\n

See also: OverviewAccounts(), RequestAccounts().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.iListDumpFile", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.iListDumpFile", "kind": "variable", "doc": "

Filename where raw data about shares, currencies, bonds, etfs and futures will be stored. Default: dump.json.

\n\n

Pandas dataframe with raw instruments data also will be stored to default file dump.xlsx.

\n\n

See also: DumpInstruments() and DumpInstrumentsAsXLSX().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.iList", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.iList", "kind": "variable", "doc": "

Dictionary with raw data about shares, currencies, bonds, etfs and futures from broker server. Auto-updating and saving dump to the iListDumpFile.

\n\n

See also: Listing(), DumpInstruments().

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.priceModel", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.priceModel", "kind": "variable", "doc": "

PriceGenerator object to work with candles data: load, render interact and non-interact charts and so on.

\n\n

See also: LoadHistory(), ShowHistoryChart() and the PriceGenerator project: https://github.com/Tim55667757/PriceGenerator

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.ticker", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.ticker", "kind": "variable", "doc": "

Setter for string with ticker, e.g. GOOGL. Tickers may be upper case only.

\n\n

Use alias for USD000UTSTOM simple as USD, EUR_RUB__TOM as EUR etc.\nMore tickers aliases here: TKSEnums.TKS_TICKER_ALIASES.

\n\n

See also: SearchByTicker(), SearchInstruments().

\n", "annotation": ": str"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.figi", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.figi", "kind": "variable", "doc": "

Setter for string with FIGI, e.g. ticker GOOGL has FIGI BBG009S39JX6. FIGIs may be upper case only.

\n\n

See also: SearchByFIGI(), SearchInstruments().

\n", "annotation": ": str"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.SendAPIRequest", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.SendAPIRequest", "kind": "function", "doc": "

Send GET or POST request to broker server and receive JSON object.

\n\n

self.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
Parameters
\n\n
    \n
  • url: url with REST request.
  • \n
  • reqType: send \"GET\" or \"POST\" request. \"GET\" by default.
  • \n
  • retry: how many times retry after first request if an 5xx server errors occurred.
  • \n
  • pause: sleep time in seconds between retries.
  • \n
\n\n
Returns
\n\n
\n

response JSON (dictionary) from broker.

\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": "

Gets JSON with raw data about shares, currencies, bonds, etfs and futures from broker server.

\n\n
Returns
\n\n
\n

Dictionary with all available broker instruments: currencies, shares, bonds, etfs and futures.

\n
\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.DumpInstrumentsAsXLSX", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.DumpInstrumentsAsXLSX", "kind": "function", "doc": "

Creates XLSX-formatted dump file with raw data of instruments to further used by data scientists or stock analytics.

\n\n

See also: DumpInstruments(), Listing().

\n\n
Parameters
\n\n
    \n
  • forceUpdate: if True then at first updates data with Listing() method,\notherwise just saves exist iList as XLSX-file (default: dump.xlsx) .
  • \n
\n", "signature": "(self, forceUpdate: bool = False) -> None:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.DumpInstruments", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.DumpInstruments", "kind": "function", "doc": "

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.

\n\n

See also: DumpInstrumentsAsXLSX(), Listing().

\n\n
Parameters
\n\n
    \n
  • forceUpdate: if True then at first updates data with Listing() method,\notherwise just saves exist iList as JSON-file (default: dump.json).
  • \n
\n\n
Returns
\n\n
\n

serialized JSON formatted str with full data of instruments, also saved to the --output JSON-file.

\n
\n", "signature": "(self, forceUpdate: bool = True) -> str:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.ShowInstrumentInfo", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.ShowInstrumentInfo", "kind": "function", "doc": "

Show information about one instrument defined by json data and prints it in Markdown format.

\n\n

See also: SearchByTicker(), SearchByFIGI(), RequestBondCoupons(), ExtendBondsData(), ShowBondsCalendar() and RequestTradingStatus().

\n\n
Parameters
\n\n
    \n
  • iJSON: json data of instrument, example: iJSON = self.iList[\"Shares\"][self._ticker]
  • \n
  • show: if True then also printing information about instrument and its current price.
  • \n
\n\n
Returns
\n\n
\n

multilines text in Markdown format with information about one instrument.

\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": "

Search and return raw broker's information about instrument by its ticker. Variable ticker must be defined!

\n\n
Parameters
\n\n
    \n
  • requestPrice: if False then do not request current price of instrument (because this is long operation).
  • \n
  • show: if False then do not run ShowInstrumentInfo() method and do not print info to the console.
  • \n
\n\n
Returns
\n\n
\n

JSON formatted data with information about instrument.

\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": "

Search and return raw broker's information about instrument by its FIGI. Variable figi must be defined!

\n\n
Parameters
\n\n
    \n
  • requestPrice: if False then do not request current price of instrument (it's long operation).
  • \n
  • show: if False then do not run ShowInstrumentInfo() method and do not print info to the console.
  • \n
\n\n
Returns
\n\n
\n

JSON formatted data with information about instrument.

\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": "

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:

\n\n
    \n
  • buy: list of dicts with Sellers prices, see also: https://tinkoff.github.io/investAPI/marketdata/#order
  • \n
  • sell: list of dicts with Buyers prices,\n
      \n
    • price: price of 1 instrument (to get the cost of the lot, you need to multiply it by the lot of size of the instrument),
    • \n
    • quantity: volume value by current price in lots,
    • \n
  • \n
  • limitUp: current trade session limit price, maximum,
  • \n
  • limitDown: current trade session limit price, minimum,
  • \n
  • lastPrice: last deal price of the instrument,
  • \n
  • closePrice: previous trade session close price of the instrument.
  • \n
\n\n

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

\n\n
Parameters
\n\n
    \n
  • show: if True then print DOM to log and console.
  • \n
\n\n
Returns
\n\n
\n

orders book dict with lists of current buy and sell prices: {\"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}.

\n
\n", "signature": "(self, show: bool = True) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.ShowInstrumentsInfo", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.ShowInstrumentsInfo", "kind": "function", "doc": "

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.

\n\n
Parameters
\n\n
    \n
  • show: if True then print results to console, if False \u2014 print only to file.
  • \n
\n\n
Returns
\n\n
\n

multi-lines string with all available broker instruments

\n
\n", "signature": "(self, show: bool = True) -> str:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.SearchInstruments", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.SearchInstruments", "kind": "function", "doc": "

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.

\n\n
Parameters
\n\n
    \n
  • pattern: string with part of ticker, FIGI or instrument's name.
  • \n
  • show: if True then print results to console, if False \u2014 return list of result only.
  • \n
\n\n
Returns
\n\n
\n

list of dictionaries with all found instruments.

\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": "

Creating list with unique instrument FIGIs from input list of tickers (priority) or FIGIs.

\n\n
Parameters
\n\n
    \n
  • instruments: list of strings with tickers or FIGIs.
  • \n
\n\n
Returns
\n\n
\n

list with unique instrument FIGIs only.

\n
\n", "signature": "(self, instruments: list[str]) -> list:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.GetListOfPrices", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.GetListOfPrices", "kind": "function", "doc": "

This method get, maybe show and return prices of list of instruments. WARNING! This is potential long operation!

\n\n

See limits: https://tinkoff.github.io/investAPI/limits/

\n\n

If pricesFile string is not empty then also save information to this file.

\n\n
Parameters
\n\n
    \n
  • instruments: list of strings with tickers or FIGIs.
  • \n
  • show: if True then prints prices to console, if False \u2014 prints only to file pricesFile.
  • \n
\n\n
Returns
\n\n
\n

list of instruments looks like [{some ticker info, \"currentPrice\": {current prices}}, {...}, ...].\n One item is dict returned by SearchByTicker() or SearchByFIGI() methods.

\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": "

Show table contains current prices of given instruments.

\n\n
Parameters
\n\n
    \n
  • **iList: list of instruments looks like [{some ticker info, \"currentPrice\"**: {current prices}}, {...}, ...].\nOne item is dict returned by SearchByTicker(requestPrice=True) or by SearchByFIGI(requestPrice=True) methods.
  • \n
  • show: if True then prints prices to console, if False \u2014 prints only to file pricesFile.
  • \n
\n\n
Returns
\n\n
\n

multilines text in Markdown format as a table contains current prices.

\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": "

Requesting trading status for the instrument defined by figi variable.

\n\n

REST API: https://tinkoff.github.io/investAPI/swagger-ui/#/MarketDataService/MarketDataService_GetTradingStatus

\n\n

Documentation: https://tinkoff.github.io/investAPI/marketdata/#gettradingstatusrequest

\n\n
Returns
\n\n
\n

dictionary with trading status attributes. Response example:\n {\"figi\": \"TCS00A103X66\", \"tradingStatus\": \"SECURITY_TRADING_STATUS_NOT_AVAILABLE_FOR_TRADING\",\n \"limitOrderAvailableFlag\": false, \"marketOrderAvailableFlag\": false, \"apiTradeAvailableFlag\": true}

\n
\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestPortfolio", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestPortfolio", "kind": "function", "doc": "

Requesting actual user's portfolio for current accountId.

\n\n

REST API for user portfolio: https://tinkoff.github.io/investAPI/swagger-ui/#/OperationsService/OperationsService_GetPortfolio

\n\n

Documentation: https://tinkoff.github.io/investAPI/operations/#portfoliorequest

\n\n
Returns
\n\n
\n

dictionary with user's portfolio.

\n
\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestPositions", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestPositions", "kind": "function", "doc": "

Requesting open positions by currencies and instruments for current accountId.

\n\n

REST API for open positions: https://tinkoff.github.io/investAPI/swagger-ui/#/OperationsService/OperationsService_GetPositions

\n\n

Documentation: https://tinkoff.github.io/investAPI/operations/#positionsrequest

\n\n
Returns
\n\n
\n

dictionary with open positions by instruments.

\n
\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestPendingOrders", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestPendingOrders", "kind": "function", "doc": "

Requesting current actual pending limit orders for current accountId.

\n\n

REST API for pending (market) orders: https://tinkoff.github.io/investAPI/swagger-ui/#/OrdersService/OrdersService_GetOrders

\n\n

Documentation: https://tinkoff.github.io/investAPI/orders/#getordersrequest

\n\n
Returns
\n\n
\n

list of dictionaries with pending limit orders.

\n
\n", "signature": "(self) -> list:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestStopOrders", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestStopOrders", "kind": "function", "doc": "

Requesting current actual stop orders for current accountId.

\n\n

REST API for opened stop-orders: https://tinkoff.github.io/investAPI/swagger-ui/#/StopOrdersService/StopOrdersService_GetStopOrders

\n\n

Documentation: https://tinkoff.github.io/investAPI/stoporders/#getstopordersrequest

\n\n
Returns
\n\n
\n

list of dictionaries with stop orders.

\n
\n", "signature": "(self) -> list:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.Overview", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.Overview", "kind": "function", "doc": "

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.

\n\n

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\n
Parameters
\n\n
    \n
  • show: if False then only dictionary returns, if True then show more debug information.
  • \n
  • details: how detailed should the information be?\n
      \n
    • full \u2014 shows full available information about portfolio status (by default),
    • \n
    • positions \u2014 shows only open positions,
    • \n
    • orders \u2014 shows only sections of open limits and stop orders.
    • \n
    • digest \u2014 show a short digest of the portfolio status,
    • \n
    • analytics \u2014 shows only the analytics section and the distribution of the portfolio by various categories,
    • \n
    • calendar \u2014 shows only the bonds calendar section (if these present in portfolio),
    • \n
  • \n
\n\n
Returns
\n\n
\n

dictionary with client's raw portfolio and some statistics.

\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": "

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.

\n\n
Parameters
\n\n
    \n
  • start: see docstring in TradeRoutines.GetDatesAsString() method.
  • \n
  • end: see docstring in TradeRoutines.GetDatesAsString() method.
  • \n
  • show: if True then also prints all records to the console.
  • \n
  • showCancelled: if False then remove information about cancelled operations from the deals report.
  • \n
\n\n
Returns
\n\n
\n

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
\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": "

This method returns last history candles of the current instrument defined by ticker or figi (FIGI id).

\n\n

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.

\n\n

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.

\n\n

See also: LoadHistory() and ShowHistoryChart() methods.

\n\n
Parameters
\n\n
    \n
  • start: see docstring in TradeRoutines.GetDatesAsString() method.
  • \n
  • end: see docstring in TradeRoutines.GetDatesAsString() method.
  • \n
  • interval: this is a candle interval. Current available values are \"1min\", \"5min\", \"15min\",\n\"hour\", \"day\". Default: \"hour\".
  • \n
  • onlyMissing: if 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!
  • \n
  • csvSep: separator if csv-file is used, , by default.
  • \n
  • show: if True then also prints Pandas DataFrame to the console.
  • \n
\n\n
Returns
\n\n
\n

Pandas DataFrame with prices history. Headers of columns are defined by default:\n [\"date\", \"time\", \"open\", \"high\", \"low\", \"close\", \"volume\"].

\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": "

Load candles history from csv-file and return Pandas DataFrame object.

\n\n

See also: History() and ShowHistoryChart() methods.

\n\n
Parameters
\n\n
    \n
  • filePath: path to csv-file to open.
  • \n
\n", "signature": "(self, filePath: str) -> pandas.core.frame.DataFrame:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.ShowHistoryChart", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.ShowHistoryChart", "kind": "function", "doc": "

Render an HTML-file with interact or non-interact candlesticks chart. Candles may be path to the csv-file.

\n\n

Self 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).

\n\n

See also: History() and LoadHistory() methods.

\n\n
Parameters
\n\n\n", "signature": "(\tself,\tcandles: Union[str, pandas.core.frame.DataFrame] = None,\tinteract: bool = True,\topenInBrowser: bool = False) -> None:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.Trade", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.Trade", "kind": "function", "doc": "

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.

\n\n

See also: Order() docstring. More simple methods than Trade() are Buy() and Sell().

\n\n
Parameters
\n\n
    \n
  • operation: string \"Buy\" or \"Sell\".
  • \n
  • lots: volume, integer count of lots >= 1.
  • \n
  • tp: float > 0, target price for stop-order with \"TP\" type. It used as take profit parameter targetPrice in self.Order().
  • \n
  • sl: float > 0, target price for stop-order with \"SL\" type. It used as stop loss parameter targetPrice in self.Order().
  • \n
  • expDate: string \"Undefined\" by default or local date in future,\nit is a string with format %Y-%m-%d %H:%M:%S.
  • \n
\n\n
Returns
\n\n
\n

JSON with response from broker server.

\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": "

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.

\n\n

See also: Order() and Trade() docstrings.

\n\n
Parameters
\n\n
    \n
  • lots: volume, integer count of lots >= 1.
  • \n
  • tp: float > 0, take profit price of stop-order.
  • \n
  • sl: float > 0, stop loss price of stop-order.
  • \n
  • expDate: it's a local date in future.\nString has a format like this: %Y-%m-%d %H:%M:%S.
  • \n
\n\n
Returns
\n\n
\n

JSON with response from broker server.

\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": "

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.

\n\n

See also: Order() and Trade() docstrings.

\n\n
Parameters
\n\n
    \n
  • lots: volume, integer count of lots >= 1.
  • \n
  • tp: float > 0, take profit price of stop-order.
  • \n
  • sl: float > 0, stop loss price of stop-order.
  • \n
  • expDate: it's a local date in the future.\nString has a format like this: %Y-%m-%d %H:%M:%S.
  • \n
\n\n
Returns
\n\n
\n

JSON with response from broker server.

\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": "

Close position of given instruments.

\n\n
Parameters
\n\n
    \n
  • instruments: list of instruments defined by tickers or FIGIs that must be closed.
  • \n
  • portfolio: pre-received dictionary with open trades, returned by Overview() method.\nThis avoids unnecessary downloading data from the server.
  • \n
\n", "signature": "(self, instruments: list[str], portfolio: dict = None) -> None:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.CloseAllTrades", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.CloseAllTrades", "kind": "function", "doc": "

Close all positions of given instruments with defined type.

\n\n
Parameters
\n\n
    \n
  • iType: type of the instruments that be closed, it must be one of supported types in TKS_INSTRUMENTS list.
  • \n
  • portfolio: pre-received dictionary with open trades, returned by Overview() method.\nThis avoids unnecessary downloading data from the server.
  • \n
\n", "signature": "(self, iType: str, portfolio: dict = None) -> None:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.Order", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.Order", "kind": "function", "doc": "

Universal method to create market or limit orders with all available parameters for current accountId.\nSee more simple methods: BuyLimit(), BuyStop(), SellLimit(), SellStop().

\n\n

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\n

Warning! 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\n

If 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\n

Only one attempt and no retry for opens order. If network issue occurred you can create new request.

\n\n
Parameters
\n\n
    \n
  • operation: string \"Buy\" or \"Sell\".
  • \n
  • orderType: string \"Limit\" or \"Stop\".
  • \n
  • lots: volume, integer count of lots >= 1.
  • \n
  • targetPrice: target price > 0. This is open trade price for limit order.
  • \n
  • limitPrice: limit price >= 0. This parameter only makes sense for stop-order. If limitPrice = 0, then it set as targetPrice.\nBroker will creates limit-order with price equal to limitPrice, when current price goes to target price of stop-order.
  • \n
  • stopType: string \"Limit\" by default. This parameter only makes sense for stop-order. There are 3 stop-order types\n\"SL\", \"TP\", \"Limit\" for \"Stop loss\", \"Take profit\" and \"Stop limit\" types accordingly.\nStop loss order always executed by market price.
  • \n
  • expDate: string \"Undefined\" by default or local date in future.\nString has a format like this: %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\n
Returns
\n\n
\n

JSON with response from broker server.

\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": "

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
Parameters
\n\n
    \n
  • lots: volume, integer count of lots >= 1.
  • \n
  • targetPrice: target price > 0. This is open trade price for limit order.
  • \n
\n\n
Returns
\n\n
\n

JSON with response from broker server.

\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": "

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.

\n\n
Parameters
\n\n
    \n
  • lots: volume, integer count of lots >= 1.
  • \n
  • targetPrice: target price > 0. This is trigger price for buy stop-order.
  • \n
  • limitPrice: limit price >= 0 (limitPrice = targetPrice if limitPrice is 0). Broker will creates limit-order\nwith price equal to limitPrice, when current price goes to target price of buy stop-order.
  • \n
  • stopType: string \"Limit\" by default. There are 3 stop-order types \"SL\", \"TP\", \"Limit\"\nfor \"Stop loss\", \"Take profit\" and \"Stop limit\" types accordingly.
  • \n
  • expDate: string \"Undefined\" by default or local date in future.\nString has a format like this: %Y-%m-%d %H:%M:%S.\nThis date is converting to UTC format for server.
  • \n
\n\n
Returns
\n\n
\n

JSON with response from broker 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": "

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
Parameters
\n\n
    \n
  • lots: volume, integer count of lots >= 1.
  • \n
  • targetPrice: target price > 0. This is open trade price for limit order.
  • \n
\n\n
Returns
\n\n
\n

JSON with response from broker server.

\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": "

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.

\n\n
Parameters
\n\n
    \n
  • lots: volume, integer count of lots >= 1.
  • \n
  • targetPrice: target price > 0. This is trigger price for sell stop-order.
  • \n
  • limitPrice: limit price >= 0 (limitPrice = targetPrice if limitPrice is 0). Broker will creates limit-order\nwith price equal to limitPrice, when current price goes to target price of sell stop-order.
  • \n
  • stopType: string \"Limit\" by default. There are 3 stop-order types \"SL\", \"TP\", \"Limit\"\nfor \"Stop loss\", \"Take profit\" and \"Stop limit\" types accordingly.
  • \n
  • expDate: string \"Undefined\" by default or local date in future.\nString has a format like this: %Y-%m-%d %H:%M:%S.\nThis date is converting to UTC format for server.
  • \n
\n\n
Returns
\n\n
\n

JSON with response from broker 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": "

Cancel order or list of orders by its orderId or stopOrderId for current accountId.

\n\n
Parameters
\n\n
    \n
  • orderIDs: list of integers with orderId or stopOrderId.
  • \n
  • allOrdersIDs: pre-received lists of all active pending limit orders.\nThis avoids unnecessary downloading data from the server.
  • \n
  • allStopOrdersIDs: pre-received lists of all active stop orders.
  • \n
\n", "signature": "(\tself,\torderIDs: list,\tallOrdersIDs: list = None,\tallStopOrdersIDs: list = None) -> None:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.CloseAllOrders", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.CloseAllOrders", "kind": "function", "doc": "

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\n

Also, you can select one or more keywords case-insensitive:\norders, shares, bonds, etfs and futures from TKS_INSTRUMENTS enum to specify trades type.

\n\n

Currency positions you must close manually using buy or sell operations, CloseTrades() or CloseAllTrades() methods.

\n", "signature": "(self, *args) -> None:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.CloseAllByTicker", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.CloseAllByTicker", "kind": "function", "doc": "

Close all available (not blocked) opened trades and orders for one instrument defined by its ticker.

\n\n

This 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.

\n\n

See also: IsInLimitOrders(), GetLimitOrderIDs(), IsInStopOrders(), GetStopOrderIDs(), CloseTrades() and CloseOrders().

\n\n
Parameters
\n\n
    \n
  • instrument: string with ticker.
  • \n
\n", "signature": "(self, instrument: str) -> None:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.CloseAllByFIGI", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.CloseAllByFIGI", "kind": "function", "doc": "

Close all available (not blocked) opened trades and orders for one instrument defined by its FIGI id.

\n\n

This 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.

\n\n

See also: IsInLimitOrders(), GetLimitOrderIDs(), IsInStopOrders(), GetStopOrderIDs(), CloseTrades() and CloseOrders().

\n\n
Parameters
\n\n
    \n
  • instrument: string with FIGI id.
  • \n
\n", "signature": "(self, instrument: str) -> None:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.ParseOrderParameters", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.ParseOrderParameters", "kind": "function", "doc": "

Parse input dictionary of strings with order parameters and return dictionary with parameters to open all orders.

\n\n
Parameters
\n\n
    \n
  • operation: string \"Buy\" or \"Sell\".
  • \n
  • inputParameters: this is dict of strings that looks like this\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\n
Returns
\n\n
\n

list of dictionaries with all lots and prices to open orders that looks like this [{\"lot\": lots_1, \"price\": price_1}, {...}, ...]

\n
\n", "signature": "(operation, **inputParameters):", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.IsInPortfolio", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.IsInPortfolio", "kind": "function", "doc": "

Checks if instrument is in the user's portfolio. Instrument must be defined by ticker (highly priority) or figi.

\n\n
Parameters
\n\n
    \n
  • portfolio: dict with user's portfolio data. If None, then requests portfolio from Overview() method.
  • \n
\n\n
Returns
\n\n
\n

True if portfolio contains open position with given instrument, False otherwise.

\n
\n", "signature": "(self, portfolio: dict = None) -> bool:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.GetInstrumentFromPortfolio", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.GetInstrumentFromPortfolio", "kind": "function", "doc": "

Returns instrument from the user's portfolio if it presents there.\nInstrument must be defined by ticker (highly priority) or figi.

\n\n
Parameters
\n\n
    \n
  • portfolio: dict with user's portfolio data. If None, then requests portfolio from Overview() method.
  • \n
\n\n
Returns
\n\n
\n

dict with instrument if portfolio contains open position with this instrument, None otherwise.

\n
\n", "signature": "(self, portfolio: dict = None) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.IsInLimitOrders", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.IsInLimitOrders", "kind": "function", "doc": "

Checks if instrument is in the limit orders list. Instrument must be defined by ticker (highly priority) or figi.

\n\n

See also: CloseAllByTicker() and CloseAllByFIGI().

\n\n
Parameters
\n\n
    \n
  • portfolio: dict with user's portfolio data. If None, then requests portfolio from Overview() method.
  • \n
\n\n
Returns
\n\n
\n

True if limit orders list contains some limit orders for the instrument, False otherwise.

\n
\n", "signature": "(self, portfolio: dict = None) -> bool:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.GetLimitOrderIDs", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.GetLimitOrderIDs", "kind": "function", "doc": "

Returns list with all orderIDs of opened pending limit orders for the instrument.\nInstrument must be defined by ticker (highly priority) or figi.

\n\n

See also: CloseAllByTicker() and CloseAllByFIGI().

\n\n
Parameters
\n\n
    \n
  • portfolio: dict with user's portfolio data. If None, then requests portfolio from Overview() method.
  • \n
\n\n
Returns
\n\n
\n

list with orderIDs of limit orders.

\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": "

Checks if instrument is in the stop orders list. Instrument must be defined by ticker (highly priority) or figi.

\n\n

See also: CloseAllByTicker() and CloseAllByFIGI().

\n\n
Parameters
\n\n
    \n
  • portfolio: dict with user's portfolio data. If None, then requests portfolio from Overview() method.
  • \n
\n\n
Returns
\n\n
\n

True if stop orders list contains some stop orders for the instrument, False otherwise.

\n
\n", "signature": "(self, portfolio: dict = None) -> bool:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.GetStopOrderIDs", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.GetStopOrderIDs", "kind": "function", "doc": "

Returns list with all orderIDs of opened stop orders for the instrument.\nInstrument must be defined by ticker (highly priority) or figi.

\n\n

See also: CloseAllByTicker() and CloseAllByFIGI().

\n\n
Parameters
\n\n
    \n
  • portfolio: dict with user's portfolio data. If None, then requests portfolio from Overview() method.
  • \n
\n\n
Returns
\n\n
\n

list with orderIDs of stop orders.

\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": "

Method for obtaining the available funds for withdrawal for current accountId.

\n\n

See also:

\n\n\n\n
Returns
\n\n
\n

dict with raw data from server that contains free funds for withdrawal. Example of dict:\n {\"money\": [{\"currency\": \"rub\", \"units\": \"100\", \"nano\": 290000000}, {...}], \"blocked\": [...], \"blockedGuarantee\": [...]}.\n Here money is an array of portfolio currency positions, blocked is an array of blocked currency\n positions of the portfolio and blockedGuarantee is locked money under collateral for futures.

\n
\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.OverviewLimits", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.OverviewLimits", "kind": "function", "doc": "

Method for parsing and show table with available funds for withdrawal for current accountId.

\n\n

See also: RequestLimits().

\n\n
Parameters
\n\n
    \n
  • show: if False then only dictionary returns, if True then also print withdrawal limits to log.
  • \n
\n\n
Returns
\n\n
\n

dict with raw parsed data from server and some calculated statistics about it.

\n
\n", "signature": "(self, show: bool = False) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestAccounts", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestAccounts", "kind": "function", "doc": "

Method for requesting all brokerage accounts (accountIds) of current user detected by token.

\n\n

See also:

\n\n\n\n
Returns
\n\n
\n

dict with raw data from server that contains accounts info. Example of dict:\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 If closedDate=\"1970-01-01T00:00:00Z\" it means that account is active now.

\n
\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestUserInfo", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestUserInfo", "kind": "function", "doc": "

Method for requesting common user's information.

\n\n

See also:

\n\n\n\n
Returns
\n\n
\n

dict with raw data from server that contains user's information. Example of dict:\n {\"premStatus\": true, \"qualStatus\": false, \"qualifiedForWorkWith\": [\"bond\", \"foreign_shares\", \"leverage\",\n \"russian_shares\", \"structured_income_bonds\"], \"tariff\": \"premium\"}.

\n
\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestMarginStatus", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestMarginStatus", "kind": "function", "doc": "

Method for requesting margin calculation for defined account ID.

\n\n

See also:

\n\n\n\n
Parameters
\n\n
    \n
  • accountId: string with numeric account ID. If None, then used class field accountId.
  • \n
\n\n
Returns
\n\n
\n

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: {\"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}}.

\n
\n", "signature": "(self, accountId: str = None) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestTariffLimits", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestTariffLimits", "kind": "function", "doc": "

Method for requesting limits of current tariff (connections, API methods etc.) of current user detected by token.

\n\n

See also:

\n\n\n\n
Returns
\n\n
\n

dict with raw data from server that contains limits of current tariff. Example of dict:\n {\"unaryLimits\": [{\"limitPerMinute\": 0, \"methods\": [\"methods\", \"methods\"]}, ...],\n \"streamLimits\": [{\"streams\": [\"streams\", \"streams\"], \"limit\": 6}, ...]}.

\n
\n", "signature": "(self) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.RequestBondCoupons", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.RequestBondCoupons", "kind": "function", "doc": "

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.

\n\n

REST API: https://tinkoff.github.io/investAPI/swagger-ui/#/InstrumentsService/InstrumentsService_GetBondCoupons\nDocumentation:

\n\n\n\n

See also: ExtendBondsData().

\n\n
Parameters
\n\n
    \n
  • iJSON: raw json data of a bond from broker server, example 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\n
Returns
\n\n
\n

dictionary with bond payment calendar. Response example\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}, {...}, ...]}

\n
\n", "signature": "(self, iJSON: dict) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.ExtendBondsData", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.ExtendBondsData", "kind": "function", "doc": "

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\n

WARNING! This is too long operation if a lot of bonds requested from broker server.

\n\n

See also: ShowInstrumentInfo(), CreateBondsCalendar(), ShowBondsCalendar(), RequestBondCoupons().

\n\n
Parameters
\n\n
    \n
  • instruments: list of strings with tickers or FIGIs.
  • \n
  • xlsx: if True then also exports Pandas DataFrame to xlsx-file bondsXLSXFile, default ext-bonds.xlsx,\nfor further used by data scientists or stock analytics.
  • \n
\n\n
Returns
\n\n
\n

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
\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": "

Creates bond payments calendar as Pandas DataFrame, and also save it to the XLSX-file, calendar.xlsx by default.

\n\n

WARNING! This is too long operation if a lot of bonds requested from broker server.

\n\n

See also: ShowBondsCalendar(), ExtendBondsData().

\n\n
Parameters
\n\n
    \n
  • extBonds: Pandas DataFrame object returns by 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().
  • \n
  • xlsx: if True then also exports Pandas DataFrame to file calendarFile + \".xlsx\", calendar.xlsx by default,\nfor further used by data scientists or stock analytics.
  • \n
\n\n
Returns
\n\n
\n

Pandas DataFrame with only bond payments calendar data. Fields mean: https://tinkoff.github.io/investAPI/instruments/#coupon

\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": "

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.

\n\n

See also: ShowInstrumentInfo(), RequestBondCoupons(), CreateBondsCalendar() and ExtendBondsData().

\n\n
Parameters
\n\n
    \n
  • extBonds: Pandas DataFrame object returns by 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().
  • \n
  • show: if True then also printing bonds payment calendar to the console,\notherwise save to file calendarFile only. False by default.
  • \n
\n\n
Returns
\n\n
\n

multilines text in Markdown format with bonds payment calendar as a table.

\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": "

Method for parsing and show simple table with all available user accounts.

\n\n

See also: RequestAccounts() and OverviewUserInfo() methods.

\n\n
Parameters
\n\n
    \n
  • show: if False then only dictionary with accounts data returns, if True then also print it to log.
  • \n
\n\n
Returns
\n\n
\n

dict with parsed accounts data received from RequestAccounts() method. Example of dict:\n view = {\"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\" }, ...}}

\n
\n", "signature": "(self, show: bool = False) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.TinkoffBrokerServer.OverviewUserInfo", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "TinkoffBrokerServer.OverviewUserInfo", "kind": "function", "doc": "

Method for parsing and show all available user's data (accountIds, common user information, margin status and tariff connections limit).

\n\n

See also: OverviewAccounts(), RequestAccounts(), RequestUserInfo(), RequestMarginStatus() and RequestTariffLimits() methods.

\n\n
Parameters
\n\n
    \n
  • show: if False then only dictionary returns, if True then also print user's data to log.
  • \n
\n\n
Returns
\n\n
\n

dict with raw parsed data from server and some calculated statistics about it.

\n
\n", "signature": "(self, show: bool = False) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.Args", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "Args", "kind": "class", "doc": "

If Main() function is imported as module, then this class used to convert arguments from **kwargs as object.

\n"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.Args.__init__", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "Args.__init__", "kind": "function", "doc": "

\n", "signature": "(**kwargs)"}, {"fullname": "tksbrokerapi.TKSBrokerAPI.ParseArgs", "modulename": "tksbrokerapi.TKSBrokerAPI", "qualname": "ParseArgs", "kind": "function", "doc": "

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\n

See examples:

\n\n\n", "signature": "(**kwargs):", "funcdef": "def"}, {"fullname": "tksbrokerapi.TKSEnums", "modulename": "tksbrokerapi.TKSEnums", "kind": "module", "doc": "

Module contains a lot of constants from enums sections of Tinkoff Open API documentation used by TKSBrokerAPI module.

\n\n\n"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_DATE_TIME_FORMAT", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_DATE_TIME_FORMAT", "kind": "variable", "doc": "

Date and time string format used by Tinkoff Open API. Default: \"%Y-%m-%dT%H:%M:%SZ\".

\n", "default_value": " = '%Y-%m-%dT%H:%M:%SZ'"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_DATE_TIME_FORMAT_EXT", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_DATE_TIME_FORMAT_EXT", "kind": "variable", "doc": "

Extended date and time string format used by Tinkoff Open API. Default: \"%Y-%m-%dT%H:%M:%S.%fZ\".

\n", "default_value": " = '%Y-%m-%dT%H:%M:%S.%fZ'"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_DATE_FORMAT", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_DATE_FORMAT", "kind": "variable", "doc": "

Date string format for some methods. Default: \"%Y-%m-%d\".

\n", "default_value": " = '%Y-%m-%d'"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_PRINT_DATE_TIME_FORMAT", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_PRINT_DATE_TIME_FORMAT", "kind": "variable", "doc": "

Human-readable format of date and time string. Default: \"%Y-%m-%d %H:%M:%S\".

\n", "default_value": " = '%Y-%m-%d %H:%M:%S'"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_INSTRUMENTS", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_INSTRUMENTS", "kind": "variable", "doc": "

Type of instrument for trade methods must be only one of supported types, listed in this constant. Default: [\"Currencies\", \"Shares\", \"Bonds\", \"Etfs\", \"Futures\"]

\n", "default_value": " = ['Currencies', 'Shares', 'Bonds', 'Etfs', 'Futures']"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_TICKER_ALIASES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_TICKER_ALIASES", "kind": "variable", "doc": "

Some aliases instead official tickers for using in CLI. For example, you can use \"USD\" instead of \"USD000UTSTOM\".

\n", "default_value": " = {'USD': 'USD000UTSTOM', 'EUR': 'EUR_RUB__TOM', 'GBP': 'GBPRUB_TOM', 'CHF': 'CHFRUB_TOM', 'CNY': 'CNYRUB_TOM', 'HKD': 'HKDRUB_TOM', 'TRY': 'TRYRUB_TOM'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_CANDLE_INTERVALS", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_CANDLE_INTERVALS", "kind": "variable", "doc": "

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

\n", "default_value": " = {'Undefined': ['CANDLE_INTERVAL_UNSPECIFIED', 0, 0], '1min': ['CANDLE_INTERVAL_1_MIN', 1, 1438], '5min': ['CANDLE_INTERVAL_5_MIN', 5, 287], '15min': ['CANDLE_INTERVAL_15_MIN', 15, 95], 'hour': ['CANDLE_INTERVAL_HOUR', 60, 167], 'day': ['CANDLE_INTERVAL_DAY', 1440, 364]}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_ACCOUNT_STATUSES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_ACCOUNT_STATUSES", "kind": "variable", "doc": "

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

\n", "default_value": " = {'derivative': 'Futures and Options', 'structured_bonds': 'Structured bonds', 'closed_fund': 'Closed-ended funds', 'bond': 'Bonds with low rating', 'structured_income_bonds': 'Structured income bonds', 'foreign_shares': 'Foreign shares not included in the exchange quotation lists', 'foreign_etf': 'Foreign ETF', 'foreign_bond': 'Euro-bonds', 'russian_shares': 'Russian shares not included in quotation lists', 'leverage': 'Margin trading, unsecured leveraged trades', 'repo': 'REPO agreements'}"}, {"fullname": "tksbrokerapi.TKSEnums.TKS_TRADING_STATUSES", "modulename": "tksbrokerapi.TKSEnums", "qualname": "TKS_TRADING_STATUSES", "kind": "variable", "doc": "

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\n\n"}, {"fullname": "tksbrokerapi.Templates.MAIN_INFO_TEMPLATE", "modulename": "tksbrokerapi.Templates", "qualname": "MAIN_INFO_TEMPLATE", "kind": "variable", "doc": "

This 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\n\n"}, {"fullname": "tksbrokerapi.TradeRoutines.GetDatesAsString", "modulename": "tksbrokerapi.TradeRoutines", "qualname": "GetDatesAsString", "kind": "function", "doc": "

Create tuple of date and time strings with timezone parsed from user-friendly date.

\n\n

Warning! All dates must be in UTC time zone!

\n\n

User dates format must be like: \"%Y-%m-%d\", e.g. \"2020-02-03\" (3 Feb, 2020).

\n\n

Output date is UTC ISO time format by default: \"%Y-%m-%dT%H:%M:%SZ\".

\n\n

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.

\n\n

If start=None, end=None then return dates from yesterday to the end of the day.

\n\n

If start=some_date_1, end=None then return dates from some_date_1 to the end of the day.

\n\n

If start=some_date_1, end=some_date_2 then return dates from start of some_date_1 to end of some_date_2.

\n\n

Start day may be negative integer numbers: -1, -2, -3 \u2014 how many days ago.

\n\n

Also, you can use keywords for start if end=None:

\n\n
    \n
  • today (from 00:00:00 to the end of current day),
  • \n
  • yesterday (-1 day from 00:00:00 to 23:59:59),
  • \n
  • week (-7 day from 00:00:00 to the end of current day),
  • \n
  • month (-30 day from 00:00:00 to the end of current day),
  • \n
  • year (-365 day from 00:00:00 to the end of current day),
  • \n
\n\n
Parameters
\n\n
    \n
  • start: start day in format defined by userFormat or keyword.
  • \n
  • end: end day in format defined by userFormat.
  • \n
  • userFormat: user-friendly date format, e.g. \"%Y-%m-%d\".
  • \n
  • outputFormat: output string date format.
  • \n
\n\n
Returns
\n\n
\n

tuple with 2 strings (\"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.

\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": "

Convert number in nano-view mode with string parameter units and integer parameter nano to float view. Examples:

\n\n

NanoToFloat(units=\"2\", nano=500000000) -> 2.5

\n\n

NanoToFloat(units=\"0\", nano=50000000) -> 0.05

\n\n
Parameters
\n\n
    \n
  • units: integer string or integer parameter that represents the integer part of number
  • \n
  • nano: integer string or integer parameter that represents the fractional part of number
  • \n
\n\n
Returns
\n\n
\n

float view of number

\n
\n", "signature": "(units: str, nano: int) -> float:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TradeRoutines.FloatToNano", "modulename": "tksbrokerapi.TradeRoutines", "qualname": "FloatToNano", "kind": "function", "doc": "

Convert float number to nano-type view: dictionary with string units and integer nano parameters {\"units\": \"string\", \"nano\": integer}. Examples:

\n\n

FloatToNano(number=2.5) -> {\"units\": \"2\", \"nano\": 500000000}

\n\n

FloatToNano(number=0.05) -> {\"units\": \"0\", \"nano\": 50000000}

\n\n
Parameters
\n\n
    \n
  • number: float number
  • \n
\n\n
Returns
\n\n
\n

nano-type view of number: {\"units\": \"string\", \"nano\": integer}

\n
\n", "signature": "(number: float) -> dict:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TradeRoutines.UpdateClassFields", "modulename": "tksbrokerapi.TradeRoutines", "qualname": "UpdateClassFields", "kind": "function", "doc": "

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\"].

\n\n
Parameters
\n\n
    \n
  • instance: instance of class to parametrize.
  • \n
  • **params: dict with all parameters in key**: value format.
  • \n
\n", "signature": "(instance: object, params: dict) -> None:", "funcdef": "def"}, {"fullname": "tksbrokerapi.TradeRoutines.SeparateByEqualParts", "modulename": "tksbrokerapi.TradeRoutines", "qualname": "SeparateByEqualParts", "kind": "function", "doc": "

Gets input list and try to separate it by equal parts of elements.

\n\n

Examples:\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\n

If 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
Parameters
\n\n
    \n
  • elements: list of objects.
  • \n
  • parts: int, numbers of equal parts of objects.
  • \n
  • union: bool, if True and if the remainder of the separating not empty, then remainder part union with the last part.
  • \n
\n\n
Returns
\n\n
\n

list of lists with equal parts of objects.

\n
\n", "signature": "(elements: list, parts: int = 2, union: bool = True) -> list:", "funcdef": "def"}, {"fullname": "tksbrokerapi.UniLogger", "modulename": "tksbrokerapi.UniLogger", "kind": "module", "doc": "

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\n

Current internal logger name for TKSBrokerAPI module is TKSBrokerAPI-UniLogger.

\n"}, {"fullname": "tksbrokerapi.UniLogger.SetLevel", "modulename": "tksbrokerapi.UniLogger", "qualname": "SetLevel", "kind": "function", "doc": "

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\n

Initialize 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\n

Returns 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 @@

API Documentation

  • UpdateClassFields
  • +
  • + SeparateByEqualParts +
  • @@ -238,6 +241,61 @@

    163 """ 164 for name in params: 165 instance.__setattr__(name, params[name]) +166 +167 +168def SeparateByEqualParts(elements: list, parts: int = 2, union: bool = True) -> list: +169 """ +170 Gets input list and try to separate it by equal parts of elements. +171 +172 Examples: +173 SeparateByEqualParts(elements=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], parts=2) -> [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]] +174 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]] +175 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]]] +176 SeparateByEqualParts(elements=[1, 2, 3], parts=2, union=True) -> [[1], [2, 3]] +177 SeparateByEqualParts(elements=[1, 2, 3], parts=2, union=False) -> [[1], [2], [3]] +178 +179 If parts > length of elements: +180 SeparateByEqualParts(elements=[1], parts=2, union=True) -> [[1]] +181 SeparateByEqualParts(elements=[1, 2, 3], parts=4, union=True) -> [[1], [2], [3]] +182 SeparateByEqualParts(elements=[1], parts=2, union=False) -> [[1], []] +183 SeparateByEqualParts(elements=[1, 2, 3], parts=4, union=False) -> [[1], [2], [3], []] +184 +185 :param elements: list of objects. +186 :param parts: int, numbers of equal parts of objects. +187 :param union: bool, if True and if the remainder of the separating not empty, then remainder part union with the last part. +188 :return: list of lists with equal parts of objects. +189 """ +190 try: +191 result = [] +192 if elements is not None and isinstance(elements, list) and elements and isinstance(parts, int) and isinstance(union, bool): +193 count = len(elements) +194 +195 if parts == 1: +196 result = [elements] +197 +198 elif parts > count: +199 result = [[item] for item in elements] +200 +201 if not union: +202 result.extend([[] for _ in range(parts - count)]) +203 +204 else: +205 partsLen = count // parts +206 for part in range(parts): +207 result.append(elements[part * partsLen: (part + 1) * partsLen]) +208 +209 index = parts * partsLen +210 if index < count: +211 if union: +212 result[-1].extend(elements[index:]) +213 +214 else: +215 result.append(elements[index:]) +216 +217 return result +218 +219 except Exception: +220 return [] @@ -524,6 +582,105 @@

    Parameters
    + +
    + +
    + + def + SeparateByEqualParts(elements: list, parts: int = 2, union: bool = True) -> list: + + + +
    + +
    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], []]

    + +
    Parameters
    + +
      +
    • elements: list of objects.
    • +
    • parts: int, numbers of equal parts of objects.
    • +
    • union: bool, if True and if the remainder of the separating not empty, then remainder part union with the last part.
    • +
    + +
    Returns
    + +
    +

    list of lists with equal parts of objects.

    +
    +
    + +