*** ЭТА ИНФОРМАЦИЯ УСТАРЕЛА И БОЛЬШЕ НЕ АКТУАЛЬНА. СЛЕДИТЕ ЗА РАЗВИТИЕМ БИРЖИ ЗДЕСЬ: https://t.me/bitzlato_market ***
*** THIS PROJECT IS DEPRICATED AND NOT WORKING. FOLLOW INFORMATION HERE: https://t.me/bitzlato_market ***
Simple trade bot to show bitzlato exchange API
Вы можете задавать:
- Пары для торговли
- Объем выставляемого ордера в долларах
- Количество выставляемых ордеров
- Переменную отклонения от курса на покупку и/или продажу
git clone https://github.com/bitzlato/trade-bot.git
cd trade-bot
npm install
Для запуска необходим API токен. Сгенерировать его можно по адресу https://bitzlato.com/p2p/tools
node index.js --token "16e2af1f-4231-4370-a127-ca00280e568b"
Сейчас бот не умеет работать на парах с RUBM и USDM. Чтобы он не падал с ошибкой, необходимо перечислить пары в параметре запуска --pairs
Например:
node index.js --token "c4e2b089-4573-45fe-b882-80828569b5dc" --pairs=ETH-BTC,LTC-BTC,DASH-BTC,LTC-ETH,DASH-ETH
Остальные параметры:
node index.js --help
Options:
--token <token> API Token
--api [api] API endpoint
--pause [pause] Pause in ms between ticks. Default 30000
--random [random] Place random orders. Default false
--amount [amount] Order amount in USD. Default 1 USD
--pairs [pairs] List of comma-separated bitzlato pairs to work on. Default all
--bid-levels [bidLevels] List of comma-separated multipliers for buying orders. Default 1.0 0.95 0.9 0.85 0.8
--ask-levels [askLevels] List of comma-separated multipliers for selling orders. Default 1.0 1.05 1.1 1.15 1.2
-h, --help output usage information
Например:
node index.js --api https://bitzlato.com/api \
--token "dfbde5a6-119b-4c44-8194-0d6024093ead" \
--pause=10000 \
--amount 10 \
--pairs ETH-BTC,ETH-BCH \
--bid-levels 0.95 \
--ask-levels 1.05,1.12 \
/
Каждые 10 секунд бот проверят курсы на kraken, отменяет свои старые ордера, выставляет новый ордер -5% на покупку, и два ордера на продажу +5% и +12%.
API in russian language is here https://github.com/bitzlato/trade-bot/blob/master/API_bitzlato_exchange_RUS.md
** IMPORTANT **: the list of methods, parameters and data format may change while the exchange is in beta testing mode.
** IMPORTANT **: Any value representing the number of cryptocurrencies is always transmitted as a string! Money management Precision is managed by the server.
** ATTENTION **: all GET
-parameters (going after?
) are optional, for the limit
and skip
parameters on the server
should be used default values. (100 and 0 but may depend on the type of request).
All routes starting at / api / market / v1 / public /
are public and are processed without access control.
Routes starting with / api / market / v1 / private /: userId /
require authentication and verification that
the passed access token belongs to user userId
.
Allows you to get userId
for future use.
{ name: ..., userId: ..., }
name
- user's nicknameuserId
- numeric user id
Getting a list of currency pairs.
Answer format:
[
{
id: ...,
label: ...,
status: ...,
price: {
min: ...,
max: ...,
last: ...
},
volume: {
base: ...,
quote: ...
},
priceChange: ...,
},
....
]
The format for describing a currency pair is the same as the response format of the GET / api / market / v1 / public / pairs /: id
route.
Getting information about the currency pair with the identificator id.
Answer format:
{ id: ..., label: ..., status: ..., price: { min: ..., max: ..., last: ... }, volume: { base: ..., quote: ... }, priceChange: ..., }
-
id
- currency pair identifier in the format: (base) - :( quote)
, wherebase
is thebase
currency, andquote
is the quoted currency -
label
- the displayed name of the currency pair may be the same as ʻid`, but it may differ -
status
- currency pair status, possible values:active
,frozen
-
price
- information about the exchange rate for this currency pair -
price.min
- the maximum price for the last 24 hours -
price.max
- the minimum price for the last 24 hours -
price.last
- the price of the last transaction -
volume
- trading volume for this currency pair in the last 24 hours -
volume.base
- volume in base currency -
volume.quote
- volume in quoted currency -
priceChange
- price change for 24 hours, the sign is an indicator of the direction of change
Getting a list of active (open) orders.
The result should be sorted by price:
for bid
from the highest to the lowest
for ask
from the lowest to the highest
Request parameters:
-
pair
- currency pair identifier -
offerType
- order type, possible options:bid
orask
Answer format:
{ data: [ { id: ..., pair: ..., offerType: ..., amount: ..., price: ... }, ... ], maxCount: ... }
-
data
- an array with order descriptions that should be sorted bydata.price
: in the case ofbid
by ascending, and in the case of anask
descending. -
data.pair
- currency pair identifier -
data.offerType
- type of order, possible options:bid
orask
-
data.amount
- order size in thebase
currency -
data.price
- the price of thebase
currency in thequoted
-
maxCount
- the maximum number of records that the server can return (the actual number can be less)
Getting a list of recent deals (see order_logs
). Request parameters:
: pair
- currency pair identifier
Answer format:
{ data: [ { id: ..., amount: { base: ..., quote: ... }, price: ..., date: ..., type: ... }, ... ], maxCount: ... }
-
data
- an array with descriptions of recent deals -
data.id
- deal ID -
data.amount
- description of the deal size -
data.amount.base
- deal size in thebase
currency -
data.amount.quote
- deal size in` quoted 'currency -
data.price
- the price of thebase
currency in thequoted
-
data.date
- the date of the transaction -
data.side
- the type of the dealsell
orbuy
is determined by the type of a new order -
maxCount
- the maximum number of records that the server can return (the actual number can be less)
Getting a description of your own order
{
id: ...,
pair: ...,
isActive: ...,
offerType: ...,
amount: {
origin: ...,
matched: ...,
rest: ...
},
price: ...,
fee: ...,
status: ...,
created: ...
}
-
id
- order identifier -
pair
- currency pair identifier -
isActive
- a boolean sign that the order is active -
status
- description of the order processing status -
offerType
- order type, possible options:bid
orask
-
price
- the price of thebase
currency in thequoted
-
amount
- description of the order size in thebase
currency -
amount.origin
- the size specified when creating the order -
amount.matched
- the total size of deals executed on the order -
amount.rest
- how much is left before the order is closed
Cancel Order.
GET / api / market / v1 / private /: userId / orders /? Pair =: pair & limit =: limit & skip =: skip
-
pair
- currency pair identifier -
limit
- limit on the number of returned records -
skip
- the number of records that must be skipped
Getting a list of your own orders. Answer format:
{
data: [
{
...
}
],
total: ...
}
-
data
- list of order descriptions in the same format as the route response formatGET / api / market / v1 / private /: userId / orders /: orderId
-
total
- the total number of orders that satisfy the filtering conditions
Create a new order.
Request format:
{
pair: ...,
offerType: ...,
amount: ...,
price: ...
}
-
pair
- currency pair identifier -
offerType
- order type, possible options:bid
orask
-
price
- the price of thebase
currency in thequoted
-
amount
- description of the order size in thebase
currency
The response format is the same as the response format of the GET / api / market / v1 / private /: userId / orders /: orderId
route.
It allows you to evaluate the result of the creation of an order without actually creating it.
The request format is the same as the request route format POST / api / market / v1 / private /: userId / orders /
.
The response format is the same as the response format of the GET / api / market / v1 / private /: userId / orders /: orderId
route.
Exception, id
fields that cannot be determined.
GET / api / market / v1 / private /: userId / trades /? OrderId =: orderId & pair =: pair & limit =: limit & skip =: skip
Getting your own transaction history. Possible query parameters:
-
orderId
- order identifier -
pair
- currency pair identifier -
limit
- limit on the number of returned records -
skip
- the number of records that must be skipped
Answer format:
{
data: [
{
id: ...,
pair: ...,
action: ...,
amount: {
base: ...,
quote: ...
},
price: ...,
date: ...,
side: ...,
fee: ...
}
],
total: ...
}
-
data
- an array of descriptions of completed deals -
data.id
- deal ID -
data.pair
- currency pair identifier -
data.action
- type of action, possible options:bid
orask
-
data.amount
- description of the deal size -
data.amount.base
- deal size in thebase
currency -
data.amount.quote
- deal size in` quoted 'currency -
data.price
- the price of thebase
currency in thequoted
-
data.date
- the date of the deal -
data.side
- the type of the dealsell
orbuy
is determined by the type of a new order -
data.fee
- the size of the deal commission. The commission is always specified in the currency that the user received in the result of the transaction -
total
- the total number of deals that satisfy the filtering conditions
GET / api / market / v1 / public / stats / candlestick /: pair? After =: after & before =: before & width =: width
Getting data to display "candlesticks".
Request parameters:
-
pair
- currency pair identifier -
after
- time limit below the requested data. -
before
- the time limit on top of the requested data, the default value is the current time -
width
- interval width, possible values:1h
(one hour),1d
(one day). In the future, you may add other values (see binance). The default is1h
.
In the case when the number of requested candles ((before - after) / width
) is greater than 200
(any reasonable digit written
in the configuration file) - return the error 400 Bad Request
.
The values of after
and before
should be rounded down and up, respectively, along the boundaries
intervals. For example, if the query is width = 1h
, and after = 19: 10
(in fact, the query will be unix-time
), then in
As the first "candle" it is necessary to return the one that starts at 19: 00
.
Answer format:
[ { date: ..., price: { open: ..., close: ..., high: ..., low: ... }, volume: { base: ..., quote: ... } }, ... ]
The array contains a list of descriptions of "candles" with the following fields:
-
date
- the date of the creation of the candle, the beginning of the time interval corresponding to this candle -
price
- price data of thebase
currency in `quoted 'during the interval -
price.open
- at the beginning of the interval -
price.close
- at the end of the interval -
price.hight
- maximum for the interval -
price.low
- minimum for the interval -
volume
- turnover data for the interval -
volume.base
- inbase
currency -
volume.quote
- in` quoted 'currency