Documentation ¶
Overview ¶
Package tnkbroker implements trengin.Broker using Tinkoff Invest API. Supports multiple open positions at the same time. Commission in position is approximate.
Index ¶
- type Money
- type MoneyValue
- type Option
- type Tinkoff
- func (t *Tinkoff) ChangeConditionalOrder(ctx context.Context, action trengin.ChangeConditionalOrderAction) (trengin.Position, error)
- func (t *Tinkoff) ClosePosition(ctx context.Context, action trengin.ClosePositionAction) (trengin.Position, error)
- func (t *Tinkoff) OpenPosition(ctx context.Context, action trengin.OpenPositionAction) (trengin.Position, trengin.PositionClosed, error)
- func (t *Tinkoff) Run(ctx context.Context) error
- type ZeroMoney
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MoneyValue ¶
type MoneyValue struct {
Money
}
func NewMoneyValue ¶
func NewMoneyValue(v Money) *MoneyValue
func NewZeroMoneyValue ¶ added in v0.1.3
func NewZeroMoneyValue() *MoneyValue
func (*MoneyValue) ToFloat ¶
func (v *MoneyValue) ToFloat() float64
type Option ¶
type Option func(*Tinkoff)
func WithAppName ¶
WithAppName returns Option which sets x-app-name
func WithLogger ¶
WithLogger returns Option which sets logger. The default logger is no-op Logger
func WithProtectiveSpread ¶
WithProtectiveSpread returns Option which sets protective spread in percent for executing orders. The default value is 1%
func WithTradeStreamPingWaitDuration ¶ added in v0.1.3
WithTradeStreamPingWaitDuration returns Option which defines duration how long we wait for ping before reconnection
func WithTradeStreamRetryTimeout ¶ added in v0.1.2
WithTradeStreamRetryTimeout returns Option which defines retry timeout on trade stream error
type Tinkoff ¶
type Tinkoff struct {
// contains filtered or unexported fields
}
func New ¶
New creates a new Tinkoff object. It takes full-access token, user account identifier.
func (*Tinkoff) ChangeConditionalOrder ¶
func (t *Tinkoff) ChangeConditionalOrder( ctx context.Context, action trengin.ChangeConditionalOrderAction, ) (trengin.Position, error)
ChangeConditionalOrder changes stop loss and take profit of current position. It returns updated position.
func (*Tinkoff) ClosePosition ¶
func (t *Tinkoff) ClosePosition(ctx context.Context, action trengin.ClosePositionAction) (trengin.Position, error)
ClosePosition closes current position and returns closed position.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
tinkoff-checkup
Tinkoff-checkup checks all methods of Tinkoff Broker.
|
Tinkoff-checkup checks all methods of Tinkoff Broker. |
internal
|
|