Btccusd

This file implements functions for reading informations from Btcc-spot public REST endpoints.

ccs.btccusd.public.orderbook(symbol='BTCUSD', limit=None)

This function provide lists of orders for sell and buy.

Parameters:
  • symbol (String) – Symbol is currency pair.
  • limit (Integer) – It define maximum number of asks and bids. This argument is optional.
Returns:

The function return payload of http response. It is string which contains json object. Official description of keys is in the table.

Key Value Description
asks array  
bids array  
date number last update timestamp

Each item in arrays for asks and bids describe one order. Official description of array position is in the table.

Position Description
0 price
1 volume

Return type:

String

Exception:

It can raise any exception which can occur during using

  • http.client.HTTPSConnection
  • http.client.HTTPSConnection.request().
Example:
>>> import ccs
>>> response = ccs.btccusd.public.orderbook("BTCUSD")
>>> print(response)
{
    "asks":
            [
                [5721.48,0.8],
                [5721.4,0.71],
                ...
            ],
    "bids":
            [
                [5721,0.6097],
                [5720.67,0.1],
                ...
            ],
    "date":1484398991
}
>>>
>>> # Prepared validation schema
>>> schema = ccs.cfg.schema[ccs.constants.BTCCUSD]["orderbook"]
ccs.btccusd.public.ticker(symbol='BTCUSD')

This function provide detailed data of give market. This informations offer high level overview of the current states on the market. It is actual price, best bids and asks etc.

Parameters:

market (String) – Symbol is currency pair.

Returns:

The function return payload of http response. It is string which contains json object. Official description of keys is in the table.

Key Value Description
BidPrice Double bid price
AskPrice Double ask pric
Open Double open price
High Double the highest trade price in 24 hours
Low Double the lowest trade price in 24 hours
Last Double last price
LastQuantity Double last quantity
PrevCls Double close Price
Timestamp UTCTimestamp timestamp
ExecutionLimitDown Double limit Down
ExecutionLimitUp Double limit Up

Return type:

String

Exception:

It can raise any exception which can occur during using

  • http.client.HTTPSConnection
  • http.client.HTTPSConnection.request().
Example:
>>> import ccs
>>> response = ccs.btccusd.public.ticker("BTCUSD")
>>> print(response)
{
    "ticker":
        {
            "BidPrice":960.03,
            "AskPrice":1040,
            "Open":989.52,
            "High":1040,
            "Low":951.01,
            "Last":1040,
            "LastQuantity":0.138,
            "PrevCls":971.01,
            "Volume":4.8479,
            "Volume24H":5.2797,
            "Timestamp":1486037350348,
            "ExecutionLimitDown":841.87,
            "ExecutionLimitUp":1138.99
        }
}
>>>
>>> # Prepared validation schema
>>> schema = ccs.cfg.schema[ccs.constants.BTCCUSD]["ticker"]

Note

This function use REST endpoint which is described on Btcc-usd Ticker documentation.

Example of GET request:

ccs.btccusd.public.tradeHistory(symbol='BTCUSD', limit=100, since=None, sincetype=None)

This function provide history of trades.

Parameters:
  • symbol (String) – Symbol is currency pair.
  • limit (Integer) – It define maximum number of trades. This argument must be greater or equal to 1. This argument is optional. Default value is 100. Maximum is 5000.
  • since (Integer) – Setting this argument cause showing trades at or after the timestamp or tid. This argument is optional.
  • sincetype (Integer) – Available values for this argument are “id” or “time”. It specifies on which data the “since” parameter works. The default value is “id”.
Returns:

The function return payload of http response. It is string which contains json object. Official description of keys is in the table.

Key Value Description
Id String trade id.
Timestamp UTCTimestamp Unix time in seconds since 1 January 1970.
Price Double trade price
Quantity Double trade quantity
Side Char sell or buy

Return type:

String

Exception:

It can raise any exception which can occur during using

  • http.client.HTTPSConnection
  • http.client.HTTPSConnection.request().
Example:
>>> import ccs
>>> response = ccs.btccusd.public.tradeHistory("BTCUSD")
>>> print(response)
[
    {
        "Id": 19,
        "Timestamp": 1456757388489,
        "Price": 2538,
        "Quantity": 2,
        "Side": "Sell"
    },
    ...
]
>>>
>>> # Other examples of using
>>> ccs.btccusd.public.tradeHistory("BTCUSD", limit=10)
>>> ccs.btccusd.public.tradeHistory("BTCUSD", since=7000)
>>> ccs.btccusd.public.tradeHistory("BTCUSD", since=1484396000, sincetype="time")
>>> ccs.btccusd.public.tradeHistory("BTCUSD", 10, 1484396000, "time")
>>>
>>> # Prepared validation schema
>>> schema = ccs.cfg.schema[ccs.constants.BTCCUSD]["tradeHistory"]