Локальный сервер для тестирования торговых роботов на Tinkoff Invest API
[Tinkoff Invest API](https://tinkoff.github.io/investAPI/).
API .
:
`tick()`. ,
, API:
( )
:
docker run --init --rm \
-p 8080:8080 \
-v $(pwd)/.cache:/app/.cache \
-e 'DEBUG=tinkoff-local-broker:*' \
vitalets/tinkoff-local-broker
API : `localhost:8080`.
API, .
: , .
API, `postOrder()`.
`accountId=config`, `figi` ( ).
29 (js):
//
const config = {
/** / */
candleInterval: CandleInterval.CANDLE_INTERVAL_1_MIN,
/** */
from: '2022-04-29T10:00:00+03:00',
/** */
to: '2022-04-29T19:00:00+03:00',
/** */
initialCapital: 100000,
/** , % */
brokerFee: 0.3,
};
//
api.orders.postOrder({
accountId: 'config',
figi: JSON.stringify(config),
quantity: 0,
direction: 0,
orderType: 0,
orderId: '',
});
.
.
, .
`accountId=tick` ( ):
const order = await api.orders.postOrder({
accountId: 'tick',
figi: '',
quantity: 0,
direction: 0,
orderType: 0,
orderId: '',
});
if (order.message) {
// order.message .
} else {
// message , , :)
}
, :
//
while (tick()) {
//
}
//
[examples](/examples).
:
npm start
:
npm t
:
./scripts/release.sh latest
#
./scripts/release.sh x.x
.
, , .
MIT @ Vitaliy Potapov