Ruby Rest API client
gem install invest_tinkoff
- Ruby 2.3.0 or higher
client = InvestTinkoff::V2::Client.new token: 'ΠΠΠ¨_Π’ΠΠΠΠ'ΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΠΎΠ±Π»ΠΈΠ³Π°ΡΠΈΠΈ ΠΏΠΎ Π΅Ρ ΠΈΠ΄Π΅Π½ΡΠΈΡΠΈΠΊΠ°ΡΠΎΡΡ
# @id_type: InvestTinkoff::V2::InstrumentIdType
# @id: String
# @class_code: String (ΠΠ±ΡΠ·Π°ΡΠ΅Π»Π΅Π½ ΠΏΡΠΈ id_type = TICKER)
bond_by id_type:, id:, class_code: nilΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΡΠΏΠΈΡΠΊΠ° ΠΎΠ±Π»ΠΈΠ³Π°ΡΠΈΠΉ
# @instrument_status: InvestTinkoff::V2::InstrumentStatus
bonds instrument_status: InvestTinkoff::V2::InstrumentStatus::BASEΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΡΠΏΠΈΡΠΊΠ° Π²Π°Π»ΡΡ
# @instrument_status: InvestTinkoff::V2::InstrumentStatus
currencies instrument_status: InvestTinkoff::V2::InstrumentStatus::BASEΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ Π²Π°Π»ΡΡΡ ΠΏΠΎ Π΅Ρ ΠΈΠ΄Π΅Π½ΡΠΈΡΠΈΠΊΠ°ΡΠΎΡΡ
# @id_type: InvestTinkoff::V2::InstrumentIdType
# @id: String
# @class_code: String (ΠΠ±ΡΠ·Π°ΡΠ΅Π»Π΅Π½ ΠΏΡΠΈ id_type = TICKER)
currency_by id_type:, id:, class_code: nilΠΠ΅ΡΠΎΠ΄ ΡΠ΅Π΄Π°ΠΊΡΠΈΡΠΎΠ²Π°Π½ΠΈΡ ΠΈΠ·Π±ΡΠ°Π½Π½ΡΡ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½ΡΠΎΠ²
https://tinkoff.github.io/investAPI/instruments/#editfavorites
# @figis: String, ΠΏΡΠΈΠΌΠ΅Ρ: ['BBG000B9XRY4', 'BBG000BWXBC2']
# @action_type: InvestTinkoff::V2::EditFavoritesActionType
edit_favorites figis:, action_type: InvestTinkoff::V2::EditFavoritesActionType::ADDΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΠΈΠ½Π²Π΅ΡΡΠΈΡΠΈΠΎΠ½Π½ΠΎΠ³ΠΎ ΡΠΎΠ½Π΄Π° ΠΏΠΎ Π΅Π³ΠΎ ΠΈΠ΄Π΅Π½ΡΠΈΡΠΈΠΊΠ°ΡΠΎΡΡ
# @id_type: InvestTinkoff::V2::InstrumentIdType
# @id: String
# @class_code: String (ΠΠ±ΡΠ·Π°ΡΠ΅Π»Π΅Π½ ΠΏΡΠΈ id_type = TICKER)
etf_by id_type:, id:, class_code: nilΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΡΠΏΠΈΡΠΊΠ° ΠΈΠ½Π²Π΅ΡΡΠΈΡΠΈΠΎΠ½Π½ΡΡ ΡΠΎΠ½Π΄ΠΎΠ²
# @instrument_status: InvestTinkoff::V2::InstrumentStatus
etfs instrument_status: InvestTinkoff::V2::InstrumentStatus::BASEΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΡΡΡΡΠ΅ΡΡΠ° ΠΏΠΎ Π΅Π³ΠΎ ΠΈΠ΄Π΅Π½ΡΠΈΡΠΈΠΊΠ°ΡΠΎΡΡ
# @id_type: InvestTinkoff::V2::InstrumentIdType
# @id: String
# @class_code: String (ΠΠ±ΡΠ·Π°ΡΠ΅Π»Π΅Π½ ΠΏΡΠΈ id_type = TICKER)
future_by id_type:, id:, class_code: nil# ΠΡΠΈΠΌΠ΅ΡΡ:
client.future_by id_type: InvestTinkoff::V2::InstrumentIdType::FIGI, id: 'FUTSI0323000'
client.future_by id_type: InvestTinkoff::V2::InstrumentIdType::TICKER, id: 'SiH3', class_code: 'SPBFUT'ΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΡΠΏΠΈΡΠΊΠ° ΡΡΡΡΠ΅ΡΡΠΎΠ²
# @instrument_status: InvestTinkoff::V2::InstrumentStatus
futures instrument_status: InvestTinkoff::V2::InstrumentStatus::BASEΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ Π½Π°ΠΊΠΎΠΏΠ»Π΅Π½Π½ΠΎΠ³ΠΎ ΠΊΡΠΏΠΎΠ½Π½ΠΎΠ³ΠΎ Π΄ΠΎΡ ΠΎΠ΄Π° ΠΏΠΎ ΠΎΠ±Π»ΠΈΠ³Π°ΡΠΈΠΈ
https://tinkoff.github.io/investAPI/instruments/#getaccruedinterests
# @figi: String, ΠΏΡΠΈΠΌΠ΅Ρ: 'BBG00X6ZGSY7'
# @from: Time, ΠΏΡΠΈΠΌΠ΅Ρ: 1.year.ago
# @to: Time, ΠΏΡΠΈΠΌΠ΅Ρ: 2.months.from_now
accrued_interests figi:, from:, to:ΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ Π°ΠΊΡΠΈΠ²Π° ΠΏΠΎ Π΅Π³ΠΎ ΠΈΠ΄Π΅Π½ΡΠΈΡΠΈΠΊΠ°ΡΠΎΡΡ
# @id: String, ΠΏΡΠΈΠΌΠ΅Ρ: '9f083982-cf4c-418a-a0bf-8b82f16db42d'
asset_by id:ΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΡΠΏΠΈΡΠΊΠ° Π°ΠΊΡΠΈΠ²ΠΎΠ²
assetsΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ Π³ΡΠ°ΡΠΈΠΊΠ° Π²ΡΠΏΠ»Π°Ρ ΠΊΡΠΏΠΎΠ½ΠΎΠ² ΠΏΠΎ ΠΎΠ±Π»ΠΈΠ³Π°ΡΠΈΠΈ
https://tinkoff.github.io/investAPI/instruments/#getbondcoupons
# @figi: String, ΠΏΡΠΈΠΌΠ΅Ρ: 'BBG00X6ZGSY7'
# @from: Time, ΠΏΡΠΈΠΌΠ΅Ρ: 1.year.ago
# @to: Time, ΠΏΡΠΈΠΌΠ΅Ρ: 6.months.from_now
bond_coupons figi:, from:, to:ΠΠ΅ΡΠΎΠ΄ Π΄Π»Ρ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΡΠΎΠ±ΡΡΠΈΠΉ Π²ΡΠΏΠ»Π°ΡΡ Π΄ΠΈΠ²ΠΈΠ΄Π΅Π½Π΄ΠΎΠ² ΠΏΠΎ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½ΡΡ
https://tinkoff.github.io/investAPI/instruments/#getdividends
# @figi: String, ΠΏΡΠΈΠΌΠ΅Ρ: 'BBG000B9XRY4'
# @from: Time, ΠΏΡΠΈΠΌΠ΅Ρ: 1.year.ago
# @to: Time, ΠΏΡΠΈΠΌΠ΅Ρ: 1.month.from_now
dividends figi:, from:, to:ΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΠΈΠ·Π±ΡΠ°Π½Π½ΡΡ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½ΡΠΎΠ²
https://tinkoff.github.io/investAPI/instruments/#getfavorites
favoritesΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΡΠ°Π·ΠΌΠ΅ΡΠ° Π³Π°ΡΠ°Π½ΡΠΈΠΉΠ½ΠΎΠ³ΠΎ ΠΎΠ±Π΅ΡΠΏΠ΅ΡΠ΅Π½ΠΈΡ ΠΏΠΎ ΡΡΡΡΠ΅ΡΡΠ°ΠΌ
https://tinkoff.github.io/investAPI/instruments/#getfuturesmargin
# @figi: String
futures_margin figi:ΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΠΎΡΠ½ΠΎΠ²Π½ΠΎΠΉ ΠΈΠ½ΡΠΎΡΠΌΠ°ΡΠΈΠΈ ΠΎΠ± ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½ΡΠ΅
https://tinkoff.github.io/investAPI/instruments/#getinstrumentby
# @id_type: InvestTinkoff::V2::InstrumentIdType
# @id: String
# @class_code: String (ΠΠ±ΡΠ·Π°ΡΠ΅Π»Π΅Π½ ΠΏΡΠΈ id_type = TICKER)
instrument_by id_type:, id:, class_code: nil# ΠΡΠΈΠΌΠ΅ΡΡ:
client.instrument_by id_type: InvestTinkoff::V2::InstrumentIdType::FIGI, id: 'FUTSI0323000'
client.instrument_by id_type: InvestTinkoff::V2::InstrumentIdType::TICKER, id: 'SiH3', class_code: 'SPBFUT'ΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ Π°ΠΊΡΠΈΠΈ ΠΏΠΎ Π΅Ρ ΠΈΠ΄Π΅Π½ΡΠΈΡΠΈΠΊΠ°ΡΠΎΡΡ
# @id_type: InvestTinkoff::V2::InstrumentIdType
# @id: String
# @class_code: String (ΠΠ±ΡΠ·Π°ΡΠ΅Π»Π΅Π½ ΠΏΡΠΈ id_type = TICKER)
share_by id_type:, id:, class_code: nil# ΠΡΠΈΠΌΠ΅ΡΡ:
client.share_by id_type: InvestTinkoff::V2::InstrumentIdType::FIGI, id: 'BBG000B9XRY4'
client.share_by id_type: InvestTinkoff::V2::InstrumentIdType::TICKER, id: 'AAPL', class_code: 'SPBXM'ΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΡΠΏΠΈΡΠΊΠ° Π°ΠΊΡΠΈΠΉ
# @instrument_status: InvestTinkoff::V2::InstrumentStatus
shares instrument_status: InvestTinkoff::V2::InstrumentStatus::BASEΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΡΠ°ΡΠΏΠΈΡΠ°Π½ΠΈΡ ΡΠΎΡΠ³ΠΎΠ² ΡΠΎΡΠ³ΠΎΠ²ΡΡ ΠΏΠ»ΠΎΡΠ°Π΄ΠΎΠΊ
https://tinkoff.github.io/investAPI/instruments/#tradingschedulesrequest
# @exchange: String, ΠΏΡΠΈΠΌΠ΅Ρ: 'MOEX'
# @from: Time, ΠΏΡΠΈΠΌΠ΅Ρ: 1.day.from_now
# @to: Time, ΠΏΡΠΈΠΌΠ΅Ρ: 5.days.from_now
trading_schedules exchange:, from:, to:ΠΠ΅ΡΠΎΠ΄ Π·Π°ΠΏΡΠΎΡΠ° ΠΈΡΡΠΎΡΠΈΡΠ΅ΡΠΊΠΈΡ ΡΠ²Π΅ΡΠ΅ΠΉ ΠΏΠΎ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½ΡΡ
# @figi: String, ΠΏΡΠΈΠΌΠ΅Ρ: 'BBG000B9XRY4'
# @from: Time, ΠΏΡΠΈΠΌΠ΅Ρ: 1.hour.ago
# @to: Time, ΠΏΡΠΈΠΌΠ΅Ρ: Time.zone.now
# @interval: InvestTinkoff::V2::CandleInterval
candles(
figi:,
from:,
to:,
interval: InvestTinkoff::V2::CandleInterval::HOUR
)ΠΠ΅ΡΠΎΠ΄ Π·Π°ΠΏΡΠΎΡΠ° ΠΏΠΎΡΠ»Π΅Π΄Π½ΠΈΡ ΡΠ΅Π½ ΠΏΠΎ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½ΡΠ°ΠΌ
https://tinkoff.github.io/investAPI/marketdata/#getlastprices
# @figis: [String]
last_prices figis:# ΠΡΠΈΠΌΠ΅ΡΡ:
client.last_prices figis: ['BBG0013HGFT4', 'BBG0013HJJ31']ΠΠ΅ΡΠΎΠ΄ Π·Π°ΠΏΡΠΎΡΠ° ΠΏΠΎΡΠ»Π΅Π΄Π½ΠΈΡ ΠΎΠ±Π΅Π·Π»ΠΈΡΠ΅Π½Π½ΡΡ ΡΠ΄Π΅Π»ΠΎΠΊ ΠΏΠΎ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½ΡΡ
https://tinkoff.github.io/investAPI/marketdata/#getlasttrades
# @figi: String, ΠΏΡΠΈΠΌΠ΅Ρ: 'BBG000B9XRY4'
# @from: Time, ΠΏΡΠΈΠΌΠ΅Ρ: 1.hour.ago
# @to: Time, ΠΏΡΠΈΠΌΠ΅Ρ: Time.zone.now
last_trades figi:, from:, to:ΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΡΡΠ°ΠΊΠ°Π½Π° ΠΏΠΎ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½ΡΡ
https://tinkoff.github.io/investAPI/marketdata/#getorderbook
# @figi: String, ΠΏΡΠΈΠΌΠ΅Ρ: 'BBG000B9XRY4'
# @depth: Integer
order_book figi:, depth: 10ΠΠ΅ΡΠΎΠ΄ Π·Π°ΠΏΡΠΎΡΠ° ΡΡΠ°ΡΡΡΠ° ΡΠΎΡΠ³ΠΎΠ² ΠΏΠΎ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½ΡΠ°ΠΌ
https://tinkoff.github.io/investAPI/marketdata/#gettradingstatus
# @figi: String, ΠΏΡΠΈΠΌΠ΅Ρ: 'BBG000B9XRY4'
trading_status figi:ΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΡΠΏΠΈΡΠΊΠ° ΠΎΠΏΠ΅ΡΠ°ΡΠΈΠΉ ΠΏΠΎ ΡΡΡΡΡ
https://tinkoff.github.io/investAPI/operations/#getoperations
# @account_id: String
# @figi: String, ΠΏΡΠΈΠΌΠ΅Ρ: 'BBG000B9XRY4'
# @from: Time
# @to: Time
# @state (ΠΎΠΏΠΈΡΠΈΠΎΠ½Π°Π»ΡΠ½ΠΎ): InvestTinkoff::V2::OperationState
operations(
account_id:,
figi:,
from:,
to:,
state: InvestTinkoff::V2::OperationState::UNSPECIFIED
)ΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΠΏΠΎΡΡΡΠ΅Π»Ρ ΠΏΠΎ ΡΡΡΡΡ
https://tinkoff.github.io/investAPI/operations/#getportfolio
# @account_id: String
portfolio account_id:ΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΡΠΏΠΈΡΠΊΠ° ΠΏΠΎΠ·ΠΈΡΠΈΠΉ ΠΏΠΎ ΡΡΡΡΡ
https://tinkoff.github.io/investAPI/operations/#getpositions
# @account_id: String
positions account_id:ΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ Π΄ΠΎΡΡΡΠΏΠ½ΠΎΠ³ΠΎ ΠΎΡΡΠ°ΡΠΊΠ° Π΄Π»Ρ Π²ΡΠ²ΠΎΠ΄Π° ΡΡΠ΅Π΄ΡΡΠ²
https://tinkoff.github.io/investAPI/operations/#getwithdrawlimits
# @account_id: String
withdraw_limits account_id:ΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ Π±ΡΠΎΠΊΠ΅ΡΡΠΊΠΎΠ³ΠΎ ΠΎΡΡΡΡΠ° NotImplemented
https://tinkoff.github.io/investAPI/operations/#getbrokerreport
broker_reportΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΠΎΡΡΡΡΠ° "Π‘ΠΏΡΠ°Π²ΠΊΠ° ΠΎ Π΄ΠΎΡ
ΠΎΠ΄Π°Ρ
Π·Π° ΠΏΡΠ΅Π΄Π΅Π»Π°ΠΌΠΈ Π Π€" NotImplemented
https://tinkoff.github.io/investAPI/operations/#getdividendsforeignissuer
dividends_foreign_issuerΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΡΠΏΠΈΡΠΊΠ° Π°ΠΊΡΠΈΠ²Π½ΡΡ Π·Π°ΡΠ²ΠΎΠΊ ΠΏΠΎ ΡΡΡΡΡ
# @account_id: String
orders account_id:ΠΠ΅ΡΠΎΠ΄ Π²ΡΡΡΠ°Π²Π»Π΅Π½ΠΈΡ Π·Π°ΡΠ²ΠΊΠΈ
# @account_id: String
# @figi: String
# @quantity: Integer
# @price: Float
# @direction: InvestTinkoff::V2::OrderDirection
# @order_type: InvestTinkoff::V2::OrderType
# @order_id: String (max length 36)
create_order(
account_id:,
figi:,
quantity:,
price:,
direction:,
order_type:,
order_id:
)# ΠΡΠΈΠΌΠ΅Ρ:
client.create_order(
account_id: 'ΠΠΠ¨_ID_Π‘Π§ΠΠ’Π',
figi: 'BBG000BL9C59',
quantity: 1,
price: 11.35,
direction: InvestTinkoff::V2::OrderDirection::BUY,
order_type: InvestTinkoff::V2::OrderType::LIMIT,
order_id: 'ΠΠΠ¨_ΠΠΠ£Π’Π ΠΠΠΠΠ_ID_ΠΠΠ―ΠΠΠ'
)ΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΡΡΠ°ΡΡΡΠ° ΡΠΎΡΠ³ΠΎΠ²ΠΎΠ³ΠΎ ΠΏΠΎΡΡΡΠ΅Π½ΠΈΡ
# @account_id: String
# @order_id: String
order_state account_id:, order_id:ΠΠ΅ΡΠΎΠ΄ ΠΎΡΠΌΠ΅Π½Ρ Π±ΠΈΡΠΆΠ΅Π²ΠΎΠΉ Π·Π°ΡΠ²ΠΊΠΈ
# @account_id: String
# @order_id: String
cancel_order account_id:, order_id:ΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΡΠΏΠΈΡΠΊΠ° Π°ΠΊΡΠΈΠ²Π½ΡΡ ΡΡΠΎΠΏ Π·Π°ΡΠ²ΠΎΠΊ ΠΏΠΎ ΡΡΡΡΡ
https://tinkoff.github.io/investAPI/stoporders/#getstoporders
# @account_id: String
stop_orders account_id:ΠΠ΅ΡΠΎΠ΄ Π²ΡΡΡΠ°Π²Π»Π΅Π½ΠΈΡ ΡΡΠΎΠΏ-Π·Π°ΡΠ²ΠΊΠΈ
https://tinkoff.github.io/investAPI/stoporders/#poststoporder
# @account_id: String
# @figi: String, ΠΏΡΠΈΠΌΠ΅Ρ: 'BBG000B9XRY4'
# @quantity: Integer
# @price: Float
# @stop_price: Float
# @expiration_type: InvestTinkoff::V2::StopOrderExpirationType
# @stop_order_type: InvestTinkoff::V2::StopOrderType
create_stop_order(
account_id:,
figi:,
quantity:,
price:,
stop_price:,
expire_date:,
expiration_type: InvestTinkoff::V2::StopOrderExpirationType::UNSPECIFIED,
stop_order_type: InvestTinkoff::V2::StopOrderType::UNSPECIFIED,
)ΠΠ΅ΡΠΎΠ΄ ΠΎΡΠΌΠ΅Π½Ρ ΡΡΠΎΠΏ-Π·Π°ΡΠ²ΠΊΠΈ
https://tinkoff.github.io/investAPI/stoporders/#cancelstoporder
# @account_id: String
# @order_id: String
cancel_stop_order account_id:, order_id:ΠΠΎΠ»ΡΡΠ΅Π½ΠΈΠ΅ ΡΠΏΡΠ°Π²ΠΎΡΠ½ΠΎΠΉ ΠΈΠ½ΡΠΎΡΠΌΠ°ΡΠΈΠΈ ΠΎ ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»Π΅ Π’ΠΈΠ½ΡΠΊΠΎΡΡ ΠΠ½Π²Π΅ΡΡΠΈΡΠΈΠΉ
ΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΡΡΠ΅ΡΠΎΠ² ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»Ρ
accountsΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΠΈΠ½ΡΠΎΡΠΌΠ°ΡΠΈΠΈ ΠΎ ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»Π΅
infoΠ Π°ΡΡΡΡ ΠΌΠ°ΡΠΆΠΈΠ½Π°Π»ΡΠ½ΡΡ ΠΏΠΎΠΊΠ°Π·Π°ΡΠ΅Π»Π΅ΠΉ ΠΏΠΎ ΡΡΡΡΡ
https://tinkoff.github.io/investAPI/users/#getmarginattributes
# @account_id: String
margin_attributes account_id:Π’Π΅ΠΊΡΡΠΈΠΉ ΡΠ°ΡΠΈΡ ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»Ρ (Π»ΠΈΠΌΠΈΡΡ Π·Π°ΠΏΡΠΎΡΠΎΠ² ΠΊ API)
user_tariffclient = InvestTinkoff::V2::SandboxClient.new token: 'ΠΠΠ¨_Π’ΠΠΠΠ_ΠΠΠ‘ΠΠ§ΠΠΠ¦Π«'ΠΠ΅ΡΠΎΠ΄ ΠΎΡΠΌΠ΅Π½Ρ ΡΠΎΡΠ³ΠΎΠ²ΠΎΠ³ΠΎ ΠΏΠΎΡΡΡΠ΅Π½ΠΈΡ Π² ΠΏΠ΅ΡΠΎΡΠ½ΠΈΡΠ΅
https://tinkoff.github.io/investAPI/sandbox/#cancelsandboxorder
# @account_id: String
# @order_id: String
cancel_sandbox_order account_id:, order_id:ΠΠ΅ΡΠΎΠ΄ Π·Π°ΠΊΡΡΡΠΈΡ ΡΡΡΡΠ° Π² ΠΏΠ΅ΡΠΎΡΠ½ΠΈΡΠ΅
https://tinkoff.github.io/investAPI/sandbox/#closesandboxaccount
# @account_id: String
close_sandbox_account account_id:ΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΡΡΠ΅ΡΠΎΠ² Π² ΠΏΠ΅ΡΠΎΡΠ½ΠΈΡΠ΅
https://tinkoff.github.io/investAPI/sandbox/#getsandboxaccounts
sandbox_accountsΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΠΎΠΏΠ΅ΡΠ°ΡΠΈΠΉ Π² ΠΏΠ΅ΡΠΎΡΠ½ΠΈΡΠ΅ ΠΏΠΎ Π½ΠΎΠΌΠ΅ΡΡ ΡΡΡΡΠ°
https://tinkoff.github.io/investAPI/sandbox/#getsandboxoperations
# @account_id: String
# @figi: String, ΠΏΡΠΈΠΌΠ΅Ρ: 'BBG000B9XRY4'
# @from: Time
# @to: Time
# @state (ΠΎΠΏΠΈΡΠΈΠΎΠ½Π°Π»ΡΠ½ΠΎ): InvestTinkoff::V2::OperationState
sandbox_operations(
account_id:,
figi:,
from:,
to:,
state: InvestTinkoff::V2::OperationState::UNSPECIFIED
)ΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΡΡΠ°ΡΡΡΠ° Π·Π°ΡΠ²ΠΊΠΈ Π² ΠΏΠ΅ΡΠΎΡΠ½ΠΈΡΠ΅
https://tinkoff.github.io/investAPI/sandbox/#getsandboxorderstate
# @account_id: String
# @order_id: String
sandbox_order_state account_id:, order_id:ΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΡΠΏΠΈΡΠΊΠ° Π°ΠΊΡΠΈΠ²Π½ΡΡ Π·Π°ΡΠ²ΠΎΠΊ ΠΏΠΎ ΡΡΡΡΡ Π² ΠΏΠ΅ΡΠΎΡΠ½ΠΈΡΠ΅
https://tinkoff.github.io/investAPI/sandbox/#getsandboxorders
# @account_id: String
sandbox_orders account_id:ΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΠΏΠΎΡΡΡΠΎΠ»ΠΈΠΎ Π² ΠΏΠ΅ΡΠΎΡΠ½ΠΈΡΠ΅
https://tinkoff.github.io/investAPI/sandbox/#getsandboxportfolio
# @account_id: String
sandbox_portfolio account_id:ΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΠΏΠΎΠ·ΠΈΡΠΈΠΉ ΠΏΠΎ Π²ΠΈΡΡΡΠ°Π»ΡΠ½ΠΎΠΌΡ ΡΡΡΡΡ ΠΏΠ΅ΡΠΎΡΠ½ΠΈΡΡ
https://tinkoff.github.io/investAPI/sandbox/#getsandboxpositions
# @account_id: String
sandbox_positions account_id:ΠΠ΅ΡΠΎΠ΄ ΡΠ΅Π³ΠΈΡΡΡΠ°ΡΠΈΠΈ ΡΡΡΡΠ° Π² ΠΏΠ΅ΡΠΎΡΠ½ΠΈΡΠ΅
https://tinkoff.github.io/investAPI/sandbox/#opensandboxaccount
open_sandbox_accountΠΠ΅ΡΠΎΠ΄ Π²ΡΡΡΠ°Π²Π»Π΅Π½ΠΈΡ ΡΠΎΡΠ³ΠΎΠ²ΠΎΠ³ΠΎ ΠΏΠΎΡΡΡΠ΅Π½ΠΈΡ Π² ΠΏΠ΅ΡΠΎΡΠ½ΠΈΡΠ΅
https://tinkoff.github.io/investAPI/sandbox/#postsandboxorder
# @account_id: String
# @figi: String
# @quantity: Integer
# @price: Float
# @direction: InvestTinkoff::V2::OrderDirection
# @order_type: InvestTinkoff::V2::OrderType
# @order_id: String (max length 36)
create_sandbox_order(
account_id:,
figi:,
quantity:,
price:,
direction:,
order_type:,
order_id:
)ΠΠ΅ΡΠΎΠ΄ ΠΏΠΎΠΏΠΎΠ»Π½Π΅Π½ΠΈΡ ΡΡΡΡΠ° Π² ΠΏΠ΅ΡΠΎΡΠ½ΠΈΡΠ΅
# @account_id: String
# @amount: Float
# @currency: String, ΠΏΡΠΈΠΌΠ΅Ρ 'RUB', 'USD', 'EUR' ΠΈ Ρ.Π΄.
sandbox_pay_in account_id:, amount:, currency:Deprecated
ΠΡΠ΅ Π½ΠΎΠ²ΡΠ΅ ΡΠ°Π±ΠΎΡΠΈΠ΅ ΡΠΎΠΊΠ΅Π½Ρ Π΄ΠΎΡΡΡΠΏΠ½Ρ ΡΠΎΠ»ΡΠΊΠΎ Π΄Π»Ρ Π²Π΅ΡΡΠΈΠΈ V2. ΠΠΎΠ΄Π΄Π΅ΡΠΆΠΊΠ° ΠΏΠ΅ΡΠ²ΠΎΠΉ Π²Π΅ΡΡΠΈΠΈ Π±ΡΠ΄Π΅Ρ Π·Π°Π²Π΅ΡΡΠ΅Π½Π° Π² 2022 Π³ΠΎΠ΄Ρ.
client = InvestTinkoff::V1::SandboxClient.new token: 'ΠΠΠ¨_Π’ΠΠΠΠ'ΠΠΎΠ»ΡΡΠ΅Π½ΠΈΠ΅ ΡΠΏΠΈΡΠΊΠ° Π°ΠΊΡΠΈΠ²Π½ΡΡ Π·Π°ΡΠ²ΠΎΠΊ
ordersΠ‘ΠΎΠ·Π΄Π°Π½ΠΈΠ΅ Π»ΠΈΠΌΠΈΡΠ½ΠΎΠΉ Π·Π°ΡΠ²ΠΊΠΈ
orders_limit_order figi:, operation:, lots:, price:Π‘ΠΎΠ·Π΄Π°Π½ΠΈΠ΅ ΡΡΠ½ΠΎΡΠ½ΠΎΠΉ Π·Π°ΡΠ²ΠΊΠΈ
orders_market_order figi:, operation:, lots:ΠΡΠΌΠ΅Π½Π° Π·Π°ΡΠ²ΠΊΠΈ
orders_cancel idΠΠΎΠ»ΡΡΠ΅Π½ΠΈΠ΅ ΠΏΠΎΡΡΡΠ΅Π»Ρ ΠΊΠ»ΠΈΠ΅Π½ΡΠ°
portfolioΠΠΎΠ»ΡΡΠ΅Π½ΠΈΠ΅ Π²Π°Π»ΡΡΠ½ΡΡ Π°ΠΊΡΠΈΠ²ΠΎΠ² ΠΊΠ»ΠΈΠ΅Π½ΡΠ°
portfolio_currenciesΠΠΎΠ»ΡΡΠ΅Π½ΠΈΠ΅ ΡΠΏΠΈΡΠΊΠ° Π°ΠΊΡΠΈΠΉ
market_stocksΠΠΎΠ»ΡΡΠ΅Π½ΠΈΠ΅ ΡΠΏΠΈΡΠΊΠ° ΠΎΠ±Π»ΠΈΠ³Π°ΡΠΈΠΉ
market_bondsΠΠΎΠ»ΡΡΠ΅Π½ΠΈΠ΅ ΡΠΏΠΈΡΠΊΠ° ETF
market_etfsΠΠΎΠ»ΡΡΠ΅Π½ΠΈΠ΅ ΡΠΏΠΈΡΠΊΠ° Π²Π°Π»ΡΡΠ½ΡΡ ΠΏΠ°Ρ
market_currenciesΠΠΎΠ»ΡΡΠ΅Π½ΠΈΠ΅ ΡΡΠ°ΠΊΠ°Π½Π° ΠΏΠΎ FIGI
market_orderbook figi:, depth: 20ΠΠΎΠ»ΡΡΠ΅Π½ΠΈΠ΅ ΠΈΡΡΠΎΡΠΈΡΠ΅ΡΠΊΠΈΡ ΡΠ²Π΅ΡΠ΅ΠΉ ΠΏΠΎ FIGI
market_candles figi:, from:, to:, interval:ΠΠΎΠ»ΡΡΠ΅Π½ΠΈΠ΅ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½ΡΠ° ΠΏΠΎ FIGI
market_search_by_figi figiΠΠΎΠ»ΡΡΠ΅Π½ΠΈΠ΅ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½ΡΠ° ΠΏΠΎ ΡΠΈΠΊΠ΅ΡΡ
market_search_by_ticker tickerΠΠΎΠ»ΡΡΠ΅Π½ΠΈΠ΅ ΡΠΏΠΈΡΠΊΠ° ΠΎΠΏΠ΅ΡΠ°ΡΠΈΠΉ
operations from:, to:, figi: nilΠΠΎΠ»ΡΡΠ΅Π½ΠΈΠ΅ Π±ΡΠΎΠΊΠ΅ΡΡΠΊΠΈΡ ΡΡΠ΅ΡΠΎΠ² ΠΊΠ»ΠΈΠ΅Π½ΡΠ°
user_accountsΠΡΠ΅ ΠΎΠΏΠ΅ΡΠ°ΡΠΈΠΈ ΡΠ°Π±ΠΎΡΠ΅Π³ΠΎ ΠΊΠ»ΠΈΠ΅Π½ΡΠ° ΠΏΠ»ΡΡ:
client = InvestTinkoff::V1::SandboxClient.new token: 'ΠΠΠ¨_Π’ΠΠΠΠ_ΠΠΠ‘ΠΠ§ΠΠΠ¦Π«'Π‘ΠΎΠ·Π΄Π°Π½ΠΈΠ΅ ΡΡΠ΅ΡΠ° ΠΈ Π²ΡΡΡΠ°Π²Π»Π΅Π½ΠΈΠ΅ Π±Π°Π»Π°Π½ΡΠ° ΠΏΠΎ Π²Π°Π»ΡΡΠ½ΡΠΌ ΠΏΠΎΠ·ΠΈΡΠΈΡΠΌ
registerΠΡΡΡΠ°Π²Π»Π΅Π½ΠΈΠ΅ Π±Π°Π»Π°Π½ΡΠ° ΠΏΠΎ Π²Π°Π»ΡΡΠ½ΡΠΌ ΠΏΠΎΠ·ΠΈΡΠΈΡΠΌ
currencies_balance currency:, balance:ΠΡΡΡΠ°Π²Π»Π΅Π½ΠΈΠ΅ Π±Π°Π»Π°Π½ΡΠ° ΠΏΠΎ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½ΡΠ½ΡΠΌ ΠΏΠΎΠ·ΠΈΡΠΈΡΠΌ
position_balance figi:, balance:Π£Π΄Π°Π»Π΅Π½ΠΈΠ΅ Π²ΡΠ΅Ρ ΠΏΠΎΠ·ΠΈΡΠΈΠΉ ΠΊΠ»ΠΈΠ΅Π½ΡΠ°
clearΠ£Π΄Π°Π»Π΅Π½ΠΈΠ΅ ΡΡΠ΅ΡΠ° ΠΊΠ»ΠΈΠ΅Π½ΡΠ°
remove