TinkoffInvest (tinkoff_invest v0.2.1) View Source
Convenient functions for frequent use-cases
Link to this section Summary
Functions
Change broker account id. Useful when wanna switch between accounts dynamically.
Change token dynamically without restarting app. Useful when using multiple broker accounts on different clients
Returns API endpoint for current mode
Returns boolean indicating whether logs are enabled or not
Returns current mode
Takes payload from response and returns it, useful for piping
Change mode dynamically.
Enables or disables logging API response via Logger.debug/1
Link to this section Types
Specs
mode() :: :sandbox | :production
Link to this section Functions
Specs
change_account_id(String.t()) :: :ok
Change broker account id. Useful when wanna switch between accounts dynamically.
iex> TinkoffInvest.change_account_id("SB1234")
:ok
Specs
change_token(String.t()) :: :ok
Change token dynamically without restarting app. Useful when using multiple broker accounts on different clients
iex> TinkoffInvest.change_token("mytoken")
:ok
Specs
endpoint() :: String.t()
Returns API endpoint for current mode
iex> TinkoffInvest.endpoint()
"https://api-invest.tinkoff.ru/openapi/sandbox"
Specs
logs_enabled?() :: boolean()
Returns boolean indicating whether logs are enabled or not
iex> TinkoffInvest.logs_enabled?()
false
Specs
mode() :: mode()
Returns current mode
iex> TinkoffInvest.mode()
:sandbox
Specs
payload(TinkoffInvest.Model.Api.Response.t()) :: term()
Takes payload from response and returns it, useful for piping
iex> TinkoffInvest.payload(%TinkoffInvest.Model.Api.Response{tracking_id: "123", status_code: 200, status: "Ok", payload: []})
[]
Specs
set_mode(mode()) :: :ok
Change mode dynamically.
iex> TinkoffInvest.set_mode(:sandbox)
:ok
Specs
toggle_logs(boolean()) :: :ok
Enables or disables logging API response via Logger.debug/1
false
by default
iex> TinkoffInvest.toggle_logs(false)
:ok