repo_name
stringclasses 6
values | pr_number
int64 99
20.3k
| pr_title
stringlengths 8
158
| pr_description
stringlengths 0
6.54k
| author
stringlengths 4
18
| date_created
unknown | date_merged
unknown | previous_commit
stringlengths 40
40
| pr_commit
stringlengths 40
40
| query
stringlengths 37
6.57k
| filepath
stringlengths 8
153
| before_content
stringlengths 0
876M
| after_content
stringlengths 0
876M
| label
int64 -1
1
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ccxt/ccxt | 8,318 | SBTC mapping | https://coinmarketcap.com/currencies/sbtc/markets/
https://coinmarketcap.com/currencies/super-bitcoin/
https://www.coingecko.com/en/coins/siambitcoin | ndubel | "2021-01-21T10:35:23" | "2021-01-21T20:04:45" | 2614db0ebd43f3cf9e1222bde6cefbabb955f681 | 05f5feeaaac3d213bc1314ba47b814db9ac30852 | SBTC mapping. https://coinmarketcap.com/currencies/sbtc/markets/
https://coinmarketcap.com/currencies/super-bitcoin/
https://www.coingecko.com/en/coins/siambitcoin | ./js/lykke.js | 'use strict';
// ---------------------------------------------------------------------------
const Exchange = require ('./base/Exchange');
// ---------------------------------------------------------------------------
module.exports = class lykke extends Exchange {
describe () {
return this.deepExtend (super.describe (), {
'id': 'lykke',
'name': 'Lykke',
'countries': [ 'CH' ],
'version': 'v1',
'rateLimit': 200,
'has': {
'CORS': false,
'fetchOHLCV': false,
'fetchOpenOrders': true,
'fetchClosedOrders': true,
'fetchOrder': true,
'fetchOrders': true,
'fetchTrades': true,
'fetchMyTrades': true,
'createOrder': true,
'cancelOrder': true,
'cancelAllOrders': true,
'fetchBalance': true,
'fetchMarkets': true,
'fetchOrderBook': true,
'fetchTicker': true,
},
'timeframes': {
'1m': 'Minute',
'5m': 'Min5',
'15m': 'Min15',
'30m': 'Min30',
'1h': 'Hour',
'4h': 'Hour4',
'6h': 'Hour6',
'12h': 'Hour12',
'1d': 'Day',
'1w': 'Week',
'1M': 'Month',
},
'requiredCredentials': {
'apiKey': true,
'secret': false,
},
'urls': {
'logo': 'https://user-images.githubusercontent.com/1294454/34487620-3139a7b0-efe6-11e7-90f5-e520cef74451.jpg',
'api': {
'mobile': 'https://public-api.lykke.com/api',
'public': 'https://hft-api.lykke.com/api',
'private': 'https://hft-api.lykke.com/api',
},
'test': {
'mobile': 'https://public-api.lykke.com/api',
'public': 'https://hft-service-dev.lykkex.net/api',
'private': 'https://hft-service-dev.lykkex.net/api',
},
'www': 'https://www.lykke.com',
'doc': [
'https://hft-api.lykke.com/swagger/ui/',
'https://www.lykke.com/lykke_api',
],
'fees': 'https://www.lykke.com/trading-conditions',
},
'api': {
'mobile': {
'get': [
'AssetPairs/rate',
'AssetPairs/rate/{assetPairId}',
'AssetPairs/dictionary/{market}',
'Assets/dictionary',
'Candles/history/{market}/available',
'Candles/history/{market}/{assetPair}/{period}/{type}/{from}/{to}',
'Company/ownershipStructure',
'Company/registrationsCount',
'IsAlive',
'Market',
'Market/{market}',
'Market/capitalization/{market}',
'OrderBook',
'OrderBook/{assetPairId}',
'Trades/{AssetPairId}',
'Trades/Last/{assetPair}/{n}',
],
'post': [
'AssetPairs/rate/history',
'AssetPairs/rate/history/{assetPairId}',
],
},
'public': {
'get': [
'AssetPairs',
'AssetPairs/{id}',
'IsAlive',
'OrderBooks',
'OrderBooks/{AssetPairId}',
],
},
'private': {
'get': [
'Orders',
'Orders/{id}',
'Wallets',
'History/trades',
],
'post': [
'Orders/limit',
'Orders/market',
'Orders/{id}/Cancel',
'Orders/v2/market',
'Orders/v2/limit',
'Orders/stoplimit',
'Orders/bulk',
],
'delete': [
'Orders',
'Orders/{id}',
],
},
},
'fees': {
'trading': {
'tierBased': false,
'percentage': true,
'maker': 0.0, // as of 7 Feb 2018, see https://github.com/ccxt/ccxt/issues/1863
'taker': 0.0, // https://www.lykke.com/cp/wallet-fees-and-limits
},
'funding': {
'tierBased': false,
'percentage': false,
'withdraw': {
'BTC': 0.001,
},
'deposit': {
'BTC': 0,
},
},
},
'commonCurrencies': {
'XPD': 'Lykke XPD',
},
});
}
parseTrade (trade, market) {
//
// public fetchTrades
//
// {
// "id": "d5983ab8-e9ec-48c9-bdd0-1b18f8e80a71",
// "assetPairId": "BTCUSD",
// "dateTime": "2019-05-15T06:52:02.147Z",
// "volume": 0.00019681,
// "index": 0,
// "price": 8023.333,
// "action": "Buy"
// }
//
// private fetchMyTrades
// {
// Id: '3500b83c-9963-4349-b3ee-b3e503073cea',
// OrderId: '83b50feb-8615-4dc6-b606-8a4168ecd708',
// DateTime: '2020-05-19T11:17:39.31+00:00',
// Timestamp: '2020-05-19T11:17:39.31+00:00',
// State: null,
// Amount: -0.004,
// BaseVolume: -0.004,
// QuotingVolume: 39.3898,
// Asset: 'BTC',
// BaseAssetId: 'BTC',
// QuotingAssetId: 'USD',
// AssetPair: 'BTCUSD',
// AssetPairId: 'BTCUSD',
// Price: 9847.427,
// Fee: { Amount: null, Type: 'Unknown', FeeAssetId: null }
// },
const marketId = this.safeString (trade, 'AssetPairId');
const symbol = this.safeSymbol (marketId, market);
const id = this.safeString2 (trade, 'id', 'Id');
const orderId = this.safeString (trade, 'OrderId');
const timestamp = this.parse8601 (this.safeString2 (trade, 'dateTime', 'DateTime'));
const price = this.safeFloat2 (trade, 'price', 'Price');
let amount = this.safeFloat2 (trade, 'volume', 'Amount');
let side = this.safeStringLower (trade, 'action');
if (side === undefined) {
if (amount < 0) {
side = 'sell';
} else {
side = 'buy';
}
}
amount = Math.abs (amount);
const cost = price * amount;
const fee = {
'cost': 0, // There are no fees for trading. https://www.lykke.com/wallet-fees-and-limits/
'currency': market['quote'],
};
return {
'id': id,
'info': trade,
'timestamp': timestamp,
'datetime': this.iso8601 (timestamp),
'symbol': symbol,
'type': undefined,
'order': orderId,
'side': side,
'takerOrMaker': undefined,
'price': price,
'amount': amount,
'cost': cost,
'fee': fee,
};
}
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
const market = this.market (symbol);
if (limit === undefined) {
limit = 100;
}
const request = {
'AssetPairId': market['id'],
'skip': 0,
'take': limit,
};
const response = await this.mobileGetTradesAssetPairId (this.extend (request, params));
return this.parseTrades (response, market, since, limit);
}
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
const request = {};
let market = undefined;
if (limit !== undefined) {
request['take'] = limit; // How many maximum items have to be returned, max 1000 default 100.
}
if (symbol !== undefined) {
market = this.market (symbol);
request['assetPairId'] = market['id'];
}
const response = await this.privateGetHistoryTrades (this.extend (request, params));
return this.parseTrades (response, market, since, limit);
}
async fetchBalance (params = {}) {
await this.loadMarkets ();
const response = await this.privateGetWallets (params);
const result = { 'info': response };
for (let i = 0; i < response.length; i++) {
const balance = response[i];
const currencyId = this.safeString (balance, 'AssetId');
const code = this.safeCurrencyCode (currencyId);
const account = this.account ();
account['total'] = this.safeFloat (balance, 'Balance');
account['used'] = this.safeFloat (balance, 'Reserved');
result[code] = account;
}
return this.parseBalance (result);
}
async cancelOrder (id, symbol = undefined, params = {}) {
const request = { 'id': id };
return await this.privateDeleteOrdersId (this.extend (request, params));
}
async cancelAllOrders (symbol = undefined, params = {}) {
await this.loadMarkets ();
const request = {};
let market = undefined;
if (symbol !== undefined) {
market = this.market (symbol);
request['assetPairId'] = market['id'];
}
return await this.privateDeleteOrders (this.extend (request, params));
}
async createOrder (symbol, type, side, amount, price = undefined, params = {}) {
await this.loadMarkets ();
const market = this.market (symbol);
const query = {
'AssetPairId': market['id'],
'OrderAction': this.capitalize (side),
'Volume': amount,
'Asset': market['baseId'],
};
if (type === 'limit') {
query['Price'] = price;
}
const method = 'privatePostOrdersV2' + this.capitalize (type);
const result = await this[method] (this.extend (query, params));
//
// market
//
// {
// "Price": 0
// }
//
// limit
//
// {
// "Id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
// }
//
const id = this.safeString (result, 'Id');
price = this.safeFloat (result, 'Price');
return {
'id': id,
'info': result,
'clientOrderId': undefined,
'timestamp': undefined,
'datetime': undefined,
'lastTradeTimestamp': undefined,
'symbol': symbol,
'type': type,
'side': side,
'price': price,
'amount': amount,
'cost': undefined,
'average': undefined,
'filled': undefined,
'remaining': undefined,
'status': undefined,
'fee': undefined,
'trades': undefined,
};
}
async fetchMarkets (params = {}) {
const markets = await this.publicGetAssetPairs ();
//
// [ { Id: "AEBTC",
// Name: "AE/BTC",
// Accuracy: 6,
// InvertedAccuracy: 8,
// BaseAssetId: "6f75280b-a005-4016-a3d8-03dc644e8912",
// QuotingAssetId: "BTC",
// MinVolume: 0.4,
// MinInvertedVolume: 0.0001 },
// { Id: "AEETH",
// Name: "AE/ETH",
// Accuracy: 6,
// InvertedAccuracy: 8,
// BaseAssetId: "6f75280b-a005-4016-a3d8-03dc644e8912",
// QuotingAssetId: "ETH",
// MinVolume: 0.4,
// MinInvertedVolume: 0.001 } ]
//
const result = [];
for (let i = 0; i < markets.length; i++) {
const market = markets[i];
const id = this.safeString (market, 'Id');
const name = this.safeString (market, 'Name');
const [ baseId, quoteId ] = name.split ('/');
const base = this.safeCurrencyCode (baseId);
const quote = this.safeCurrencyCode (quoteId);
const symbol = base + '/' + quote;
const precision = {
'price': this.safeInteger (market, 'Accuracy'),
'amount': this.safeInteger (market, 'InvertedAccuracy'),
};
result.push ({
'id': id,
'symbol': symbol,
'base': base,
'quote': quote,
'active': true,
'info': market,
'precision': precision,
'limits': {
'amount': {
'min': Math.pow (10, -precision['amount']),
'max': Math.pow (10, precision['amount']),
},
'price': {
'min': Math.pow (10, -precision['price']),
'max': Math.pow (10, precision['price']),
},
'cost': {
'min': undefined,
'max': undefined,
},
},
'baseId': undefined,
'quoteId': undefined,
});
}
return result;
}
parseTicker (ticker, market = undefined) {
const timestamp = this.milliseconds ();
let symbol = undefined;
if (market) {
symbol = market['symbol'];
}
const close = this.safeFloat (ticker, 'lastPrice');
return {
'symbol': symbol,
'timestamp': timestamp,
'datetime': this.iso8601 (timestamp),
'high': undefined,
'low': undefined,
'bid': this.safeFloat (ticker, 'bid'),
'bidVolume': undefined,
'ask': this.safeFloat (ticker, 'ask'),
'askVolume': undefined,
'vwap': undefined,
'open': undefined,
'close': close,
'last': close,
'previousClose': undefined,
'change': undefined,
'percentage': undefined,
'average': undefined,
'baseVolume': undefined,
'quoteVolume': this.safeFloat (ticker, 'volume24H'),
'info': ticker,
};
}
async fetchTicker (symbol, params = {}) {
await this.loadMarkets ();
const market = this.market (symbol);
const request = {
'market': market['id'],
};
const ticker = await this.mobileGetMarketMarket (this.extend (request, params));
return this.parseTicker (ticker, market);
}
parseOrderStatus (status) {
const statuses = {
'Open': 'open',
'Pending': 'open',
'InOrderBook': 'open',
'Processing': 'open',
'Matched': 'closed',
'Cancelled': 'canceled',
'Rejected': 'rejected',
'Replaced': 'canceled',
'Placed': 'open',
};
return this.safeString (statuses, status, status);
}
parseOrder (order, market = undefined) {
//
// {
// "Id": "string",
// "Status": "Unknown",
// "AssetPairId": "string",
// "Volume": 0,
// "Price": 0,
// "RemainingVolume": 0,
// "LastMatchTime": "2020-03-26T20:58:50.710Z",
// "CreatedAt": "2020-03-26T20:58:50.710Z",
// "Type": "Unknown",
// "LowerLimitPrice": 0,
// "LowerPrice": 0,
// "UpperLimitPrice": 0,
// "UpperPrice": 0
// }
//
const status = this.parseOrderStatus (this.safeString (order, 'Status'));
const marketId = this.safeString (order, 'AssetPairId');
const symbol = this.safeSymbol (marketId, market);
const lastTradeTimestamp = this.parse8601 (this.safeString (order, 'LastMatchTime'));
let timestamp = undefined;
if (('Registered' in order) && (order['Registered'])) {
timestamp = this.parse8601 (order['Registered']);
} else if (('CreatedAt' in order) && (order['CreatedAt'])) {
timestamp = this.parse8601 (order['CreatedAt']);
}
const price = this.safeFloat (order, 'Price');
let side = undefined;
let amount = this.safeFloat (order, 'Volume');
if (amount < 0) {
side = 'sell';
amount = Math.abs (amount);
} else {
side = 'buy';
}
const remaining = Math.abs (this.safeFloat (order, 'RemainingVolume'));
const filled = amount - remaining;
const cost = filled * price;
const id = this.safeString (order, 'Id');
return {
'info': order,
'id': id,
'clientOrderId': undefined,
'timestamp': timestamp,
'datetime': this.iso8601 (timestamp),
'lastTradeTimestamp': lastTradeTimestamp,
'symbol': symbol,
'type': undefined,
'timeInForce': undefined,
'postOnly': undefined,
'side': side,
'price': price,
'stopPrice': undefined,
'cost': cost,
'average': undefined,
'amount': amount,
'filled': filled,
'remaining': remaining,
'status': status,
'fee': undefined,
'trades': undefined,
};
}
async fetchOrder (id, symbol = undefined, params = {}) {
await this.loadMarkets ();
const request = {
'id': id,
};
const response = await this.privateGetOrdersId (this.extend (request, params));
return this.parseOrder (response);
}
async fetchOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
const response = await this.privateGetOrders (params);
let market = undefined;
if (symbol !== undefined) {
market = this.market (symbol);
}
return this.parseOrders (response, market, since, limit);
}
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
const request = {
'status': 'InOrderBook',
};
return await this.fetchOrders (symbol, since, limit, this.extend (request, params));
}
async fetchClosedOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
const request = {
'status': 'Matched',
};
return await this.fetchOrders (symbol, since, limit, this.extend (request, params));
}
async fetchOrderBook (symbol, limit = undefined, params = {}) {
await this.loadMarkets ();
const response = await this.publicGetOrderBooksAssetPairId (this.extend ({
'AssetPairId': this.marketId (symbol),
}, params));
const orderbook = {
'timestamp': undefined,
'bids': [],
'asks': [],
};
let timestamp = undefined;
for (let i = 0; i < response.length; i++) {
const side = response[i];
if (side['IsBuy']) {
orderbook['bids'] = this.arrayConcat (orderbook['bids'], side['Prices']);
} else {
orderbook['asks'] = this.arrayConcat (orderbook['asks'], side['Prices']);
}
const sideTimestamp = this.parse8601 (side['Timestamp']);
timestamp = (timestamp === undefined) ? sideTimestamp : Math.max (timestamp, sideTimestamp);
}
return this.parseOrderBook (orderbook, timestamp, 'bids', 'asks', 'Price', 'Volume');
}
parseBidAsk (bidask, priceKey = 0, amountKey = 1) {
const price = this.safeFloat (bidask, priceKey);
let amount = this.safeFloat (bidask, amountKey);
if (amount < 0) {
amount = -amount;
}
return [ price, amount ];
}
sign (path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
let url = this.urls['api'][api] + '/' + this.implodeParams (path, params);
const query = this.omit (params, this.extractParams (path));
if (api === 'mobile') {
if (Object.keys (query).length) {
url += '?' + this.urlencode (query);
}
} else if (api === 'public') {
if (Object.keys (query).length) {
url += '?' + this.urlencode (query);
}
} else if (api === 'private') {
if ((method === 'GET') || (method === 'DELETE')) {
if (Object.keys (query).length) {
url += '?' + this.urlencode (query);
}
}
this.checkRequiredCredentials ();
headers = {
'api-key': this.apiKey,
'Accept': 'application/json',
'Content-Type': 'application/json',
};
if (method === 'POST') {
if (Object.keys (params).length) {
body = this.json (params);
}
}
}
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
}
};
| 'use strict';
// ---------------------------------------------------------------------------
const Exchange = require ('./base/Exchange');
// ---------------------------------------------------------------------------
module.exports = class lykke extends Exchange {
describe () {
return this.deepExtend (super.describe (), {
'id': 'lykke',
'name': 'Lykke',
'countries': [ 'CH' ],
'version': 'v1',
'rateLimit': 200,
'has': {
'CORS': false,
'fetchOHLCV': false,
'fetchOpenOrders': true,
'fetchClosedOrders': true,
'fetchOrder': true,
'fetchOrders': true,
'fetchTrades': true,
'fetchMyTrades': true,
'createOrder': true,
'cancelOrder': true,
'cancelAllOrders': true,
'fetchBalance': true,
'fetchMarkets': true,
'fetchOrderBook': true,
'fetchTicker': true,
},
'timeframes': {
'1m': 'Minute',
'5m': 'Min5',
'15m': 'Min15',
'30m': 'Min30',
'1h': 'Hour',
'4h': 'Hour4',
'6h': 'Hour6',
'12h': 'Hour12',
'1d': 'Day',
'1w': 'Week',
'1M': 'Month',
},
'requiredCredentials': {
'apiKey': true,
'secret': false,
},
'urls': {
'logo': 'https://user-images.githubusercontent.com/1294454/34487620-3139a7b0-efe6-11e7-90f5-e520cef74451.jpg',
'api': {
'mobile': 'https://public-api.lykke.com/api',
'public': 'https://hft-api.lykke.com/api',
'private': 'https://hft-api.lykke.com/api',
},
'test': {
'mobile': 'https://public-api.lykke.com/api',
'public': 'https://hft-service-dev.lykkex.net/api',
'private': 'https://hft-service-dev.lykkex.net/api',
},
'www': 'https://www.lykke.com',
'doc': [
'https://hft-api.lykke.com/swagger/ui/',
'https://www.lykke.com/lykke_api',
],
'fees': 'https://www.lykke.com/trading-conditions',
},
'api': {
'mobile': {
'get': [
'AssetPairs/rate',
'AssetPairs/rate/{assetPairId}',
'AssetPairs/dictionary/{market}',
'Assets/dictionary',
'Candles/history/{market}/available',
'Candles/history/{market}/{assetPair}/{period}/{type}/{from}/{to}',
'Company/ownershipStructure',
'Company/registrationsCount',
'IsAlive',
'Market',
'Market/{market}',
'Market/capitalization/{market}',
'OrderBook',
'OrderBook/{assetPairId}',
'Trades/{AssetPairId}',
'Trades/Last/{assetPair}/{n}',
],
'post': [
'AssetPairs/rate/history',
'AssetPairs/rate/history/{assetPairId}',
],
},
'public': {
'get': [
'AssetPairs',
'AssetPairs/{id}',
'IsAlive',
'OrderBooks',
'OrderBooks/{AssetPairId}',
],
},
'private': {
'get': [
'Orders',
'Orders/{id}',
'Wallets',
'History/trades',
],
'post': [
'Orders/limit',
'Orders/market',
'Orders/{id}/Cancel',
'Orders/v2/market',
'Orders/v2/limit',
'Orders/stoplimit',
'Orders/bulk',
],
'delete': [
'Orders',
'Orders/{id}',
],
},
},
'fees': {
'trading': {
'tierBased': false,
'percentage': true,
'maker': 0.0, // as of 7 Feb 2018, see https://github.com/ccxt/ccxt/issues/1863
'taker': 0.0, // https://www.lykke.com/cp/wallet-fees-and-limits
},
'funding': {
'tierBased': false,
'percentage': false,
'withdraw': {
'BTC': 0.001,
},
'deposit': {
'BTC': 0,
},
},
},
'commonCurrencies': {
'XPD': 'Lykke XPD',
},
});
}
parseTrade (trade, market) {
//
// public fetchTrades
//
// {
// "id": "d5983ab8-e9ec-48c9-bdd0-1b18f8e80a71",
// "assetPairId": "BTCUSD",
// "dateTime": "2019-05-15T06:52:02.147Z",
// "volume": 0.00019681,
// "index": 0,
// "price": 8023.333,
// "action": "Buy"
// }
//
// private fetchMyTrades
// {
// Id: '3500b83c-9963-4349-b3ee-b3e503073cea',
// OrderId: '83b50feb-8615-4dc6-b606-8a4168ecd708',
// DateTime: '2020-05-19T11:17:39.31+00:00',
// Timestamp: '2020-05-19T11:17:39.31+00:00',
// State: null,
// Amount: -0.004,
// BaseVolume: -0.004,
// QuotingVolume: 39.3898,
// Asset: 'BTC',
// BaseAssetId: 'BTC',
// QuotingAssetId: 'USD',
// AssetPair: 'BTCUSD',
// AssetPairId: 'BTCUSD',
// Price: 9847.427,
// Fee: { Amount: null, Type: 'Unknown', FeeAssetId: null }
// },
const marketId = this.safeString (trade, 'AssetPairId');
const symbol = this.safeSymbol (marketId, market);
const id = this.safeString2 (trade, 'id', 'Id');
const orderId = this.safeString (trade, 'OrderId');
const timestamp = this.parse8601 (this.safeString2 (trade, 'dateTime', 'DateTime'));
const price = this.safeFloat2 (trade, 'price', 'Price');
let amount = this.safeFloat2 (trade, 'volume', 'Amount');
let side = this.safeStringLower (trade, 'action');
if (side === undefined) {
if (amount < 0) {
side = 'sell';
} else {
side = 'buy';
}
}
amount = Math.abs (amount);
const cost = price * amount;
const fee = {
'cost': 0, // There are no fees for trading. https://www.lykke.com/wallet-fees-and-limits/
'currency': market['quote'],
};
return {
'id': id,
'info': trade,
'timestamp': timestamp,
'datetime': this.iso8601 (timestamp),
'symbol': symbol,
'type': undefined,
'order': orderId,
'side': side,
'takerOrMaker': undefined,
'price': price,
'amount': amount,
'cost': cost,
'fee': fee,
};
}
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
const market = this.market (symbol);
if (limit === undefined) {
limit = 100;
}
const request = {
'AssetPairId': market['id'],
'skip': 0,
'take': limit,
};
const response = await this.mobileGetTradesAssetPairId (this.extend (request, params));
return this.parseTrades (response, market, since, limit);
}
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
const request = {};
let market = undefined;
if (limit !== undefined) {
request['take'] = limit; // How many maximum items have to be returned, max 1000 default 100.
}
if (symbol !== undefined) {
market = this.market (symbol);
request['assetPairId'] = market['id'];
}
const response = await this.privateGetHistoryTrades (this.extend (request, params));
return this.parseTrades (response, market, since, limit);
}
async fetchBalance (params = {}) {
await this.loadMarkets ();
const response = await this.privateGetWallets (params);
const result = { 'info': response };
for (let i = 0; i < response.length; i++) {
const balance = response[i];
const currencyId = this.safeString (balance, 'AssetId');
const code = this.safeCurrencyCode (currencyId);
const account = this.account ();
account['total'] = this.safeFloat (balance, 'Balance');
account['used'] = this.safeFloat (balance, 'Reserved');
result[code] = account;
}
return this.parseBalance (result);
}
async cancelOrder (id, symbol = undefined, params = {}) {
const request = { 'id': id };
return await this.privateDeleteOrdersId (this.extend (request, params));
}
async cancelAllOrders (symbol = undefined, params = {}) {
await this.loadMarkets ();
const request = {};
let market = undefined;
if (symbol !== undefined) {
market = this.market (symbol);
request['assetPairId'] = market['id'];
}
return await this.privateDeleteOrders (this.extend (request, params));
}
async createOrder (symbol, type, side, amount, price = undefined, params = {}) {
await this.loadMarkets ();
const market = this.market (symbol);
const query = {
'AssetPairId': market['id'],
'OrderAction': this.capitalize (side),
'Volume': amount,
'Asset': market['baseId'],
};
if (type === 'limit') {
query['Price'] = price;
}
const method = 'privatePostOrdersV2' + this.capitalize (type);
const result = await this[method] (this.extend (query, params));
//
// market
//
// {
// "Price": 0
// }
//
// limit
//
// {
// "Id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
// }
//
const id = this.safeString (result, 'Id');
price = this.safeFloat (result, 'Price');
return {
'id': id,
'info': result,
'clientOrderId': undefined,
'timestamp': undefined,
'datetime': undefined,
'lastTradeTimestamp': undefined,
'symbol': symbol,
'type': type,
'side': side,
'price': price,
'amount': amount,
'cost': undefined,
'average': undefined,
'filled': undefined,
'remaining': undefined,
'status': undefined,
'fee': undefined,
'trades': undefined,
};
}
async fetchMarkets (params = {}) {
const markets = await this.publicGetAssetPairs ();
//
// [ { Id: "AEBTC",
// Name: "AE/BTC",
// Accuracy: 6,
// InvertedAccuracy: 8,
// BaseAssetId: "6f75280b-a005-4016-a3d8-03dc644e8912",
// QuotingAssetId: "BTC",
// MinVolume: 0.4,
// MinInvertedVolume: 0.0001 },
// { Id: "AEETH",
// Name: "AE/ETH",
// Accuracy: 6,
// InvertedAccuracy: 8,
// BaseAssetId: "6f75280b-a005-4016-a3d8-03dc644e8912",
// QuotingAssetId: "ETH",
// MinVolume: 0.4,
// MinInvertedVolume: 0.001 } ]
//
const result = [];
for (let i = 0; i < markets.length; i++) {
const market = markets[i];
const id = this.safeString (market, 'Id');
const name = this.safeString (market, 'Name');
const [ baseId, quoteId ] = name.split ('/');
const base = this.safeCurrencyCode (baseId);
const quote = this.safeCurrencyCode (quoteId);
const symbol = base + '/' + quote;
const precision = {
'price': this.safeInteger (market, 'Accuracy'),
'amount': this.safeInteger (market, 'InvertedAccuracy'),
};
result.push ({
'id': id,
'symbol': symbol,
'base': base,
'quote': quote,
'active': true,
'info': market,
'precision': precision,
'limits': {
'amount': {
'min': Math.pow (10, -precision['amount']),
'max': Math.pow (10, precision['amount']),
},
'price': {
'min': Math.pow (10, -precision['price']),
'max': Math.pow (10, precision['price']),
},
'cost': {
'min': undefined,
'max': undefined,
},
},
'baseId': undefined,
'quoteId': undefined,
});
}
return result;
}
parseTicker (ticker, market = undefined) {
const timestamp = this.milliseconds ();
let symbol = undefined;
if (market) {
symbol = market['symbol'];
}
const close = this.safeFloat (ticker, 'lastPrice');
return {
'symbol': symbol,
'timestamp': timestamp,
'datetime': this.iso8601 (timestamp),
'high': undefined,
'low': undefined,
'bid': this.safeFloat (ticker, 'bid'),
'bidVolume': undefined,
'ask': this.safeFloat (ticker, 'ask'),
'askVolume': undefined,
'vwap': undefined,
'open': undefined,
'close': close,
'last': close,
'previousClose': undefined,
'change': undefined,
'percentage': undefined,
'average': undefined,
'baseVolume': undefined,
'quoteVolume': this.safeFloat (ticker, 'volume24H'),
'info': ticker,
};
}
async fetchTicker (symbol, params = {}) {
await this.loadMarkets ();
const market = this.market (symbol);
const request = {
'market': market['id'],
};
const ticker = await this.mobileGetMarketMarket (this.extend (request, params));
return this.parseTicker (ticker, market);
}
parseOrderStatus (status) {
const statuses = {
'Open': 'open',
'Pending': 'open',
'InOrderBook': 'open',
'Processing': 'open',
'Matched': 'closed',
'Cancelled': 'canceled',
'Rejected': 'rejected',
'Replaced': 'canceled',
'Placed': 'open',
};
return this.safeString (statuses, status, status);
}
parseOrder (order, market = undefined) {
//
// {
// "Id": "string",
// "Status": "Unknown",
// "AssetPairId": "string",
// "Volume": 0,
// "Price": 0,
// "RemainingVolume": 0,
// "LastMatchTime": "2020-03-26T20:58:50.710Z",
// "CreatedAt": "2020-03-26T20:58:50.710Z",
// "Type": "Unknown",
// "LowerLimitPrice": 0,
// "LowerPrice": 0,
// "UpperLimitPrice": 0,
// "UpperPrice": 0
// }
//
const status = this.parseOrderStatus (this.safeString (order, 'Status'));
const marketId = this.safeString (order, 'AssetPairId');
const symbol = this.safeSymbol (marketId, market);
const lastTradeTimestamp = this.parse8601 (this.safeString (order, 'LastMatchTime'));
let timestamp = undefined;
if (('Registered' in order) && (order['Registered'])) {
timestamp = this.parse8601 (order['Registered']);
} else if (('CreatedAt' in order) && (order['CreatedAt'])) {
timestamp = this.parse8601 (order['CreatedAt']);
}
const price = this.safeFloat (order, 'Price');
let side = undefined;
let amount = this.safeFloat (order, 'Volume');
if (amount < 0) {
side = 'sell';
amount = Math.abs (amount);
} else {
side = 'buy';
}
const remaining = Math.abs (this.safeFloat (order, 'RemainingVolume'));
const filled = amount - remaining;
const cost = filled * price;
const id = this.safeString (order, 'Id');
return {
'info': order,
'id': id,
'clientOrderId': undefined,
'timestamp': timestamp,
'datetime': this.iso8601 (timestamp),
'lastTradeTimestamp': lastTradeTimestamp,
'symbol': symbol,
'type': undefined,
'timeInForce': undefined,
'postOnly': undefined,
'side': side,
'price': price,
'stopPrice': undefined,
'cost': cost,
'average': undefined,
'amount': amount,
'filled': filled,
'remaining': remaining,
'status': status,
'fee': undefined,
'trades': undefined,
};
}
async fetchOrder (id, symbol = undefined, params = {}) {
await this.loadMarkets ();
const request = {
'id': id,
};
const response = await this.privateGetOrdersId (this.extend (request, params));
return this.parseOrder (response);
}
async fetchOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
const response = await this.privateGetOrders (params);
let market = undefined;
if (symbol !== undefined) {
market = this.market (symbol);
}
return this.parseOrders (response, market, since, limit);
}
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
const request = {
'status': 'InOrderBook',
};
return await this.fetchOrders (symbol, since, limit, this.extend (request, params));
}
async fetchClosedOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
const request = {
'status': 'Matched',
};
return await this.fetchOrders (symbol, since, limit, this.extend (request, params));
}
async fetchOrderBook (symbol, limit = undefined, params = {}) {
await this.loadMarkets ();
const response = await this.publicGetOrderBooksAssetPairId (this.extend ({
'AssetPairId': this.marketId (symbol),
}, params));
const orderbook = {
'timestamp': undefined,
'bids': [],
'asks': [],
};
let timestamp = undefined;
for (let i = 0; i < response.length; i++) {
const side = response[i];
if (side['IsBuy']) {
orderbook['bids'] = this.arrayConcat (orderbook['bids'], side['Prices']);
} else {
orderbook['asks'] = this.arrayConcat (orderbook['asks'], side['Prices']);
}
const sideTimestamp = this.parse8601 (side['Timestamp']);
timestamp = (timestamp === undefined) ? sideTimestamp : Math.max (timestamp, sideTimestamp);
}
return this.parseOrderBook (orderbook, timestamp, 'bids', 'asks', 'Price', 'Volume');
}
parseBidAsk (bidask, priceKey = 0, amountKey = 1) {
const price = this.safeFloat (bidask, priceKey);
let amount = this.safeFloat (bidask, amountKey);
if (amount < 0) {
amount = -amount;
}
return [ price, amount ];
}
sign (path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
let url = this.urls['api'][api] + '/' + this.implodeParams (path, params);
const query = this.omit (params, this.extractParams (path));
if (api === 'mobile') {
if (Object.keys (query).length) {
url += '?' + this.urlencode (query);
}
} else if (api === 'public') {
if (Object.keys (query).length) {
url += '?' + this.urlencode (query);
}
} else if (api === 'private') {
if ((method === 'GET') || (method === 'DELETE')) {
if (Object.keys (query).length) {
url += '?' + this.urlencode (query);
}
}
this.checkRequiredCredentials ();
headers = {
'api-key': this.apiKey,
'Accept': 'application/json',
'Content-Type': 'application/json',
};
if (method === 'POST') {
if (Object.keys (params).length) {
body = this.json (params);
}
}
}
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
}
};
| -1 |
ccxt/ccxt | 8,318 | SBTC mapping | https://coinmarketcap.com/currencies/sbtc/markets/
https://coinmarketcap.com/currencies/super-bitcoin/
https://www.coingecko.com/en/coins/siambitcoin | ndubel | "2021-01-21T10:35:23" | "2021-01-21T20:04:45" | 2614db0ebd43f3cf9e1222bde6cefbabb955f681 | 05f5feeaaac3d213bc1314ba47b814db9ac30852 | SBTC mapping. https://coinmarketcap.com/currencies/sbtc/markets/
https://coinmarketcap.com/currencies/super-bitcoin/
https://www.coingecko.com/en/coins/siambitcoin | ./js/static_dependencies/node-rsa/formats/pkcs1.js | var ber = require('../asn1/index').Ber;
var _ = require('../utils')._;
var utils = require('../utils');
const PRIVATE_OPENING_BOUNDARY = '-----BEGIN RSA PRIVATE KEY-----';
const PRIVATE_CLOSING_BOUNDARY = '-----END RSA PRIVATE KEY-----';
const PUBLIC_OPENING_BOUNDARY = '-----BEGIN RSA PUBLIC KEY-----';
const PUBLIC_CLOSING_BOUNDARY = '-----END RSA PUBLIC KEY-----';
module.exports = {
privateExport: function (key, options) {
options = options || {};
var n = key.n.toBuffer();
var d = key.d.toBuffer();
var p = key.p.toBuffer();
var q = key.q.toBuffer();
var dmp1 = key.dmp1.toBuffer();
var dmq1 = key.dmq1.toBuffer();
var coeff = key.coeff.toBuffer();
var length = n.length + d.length + p.length + q.length + dmp1.length + dmq1.length + coeff.length + 512; // magic
var writer = new ber.Writer({size: length});
writer.startSequence();
writer.writeInt(0);
writer.writeBuffer(n, 2);
writer.writeInt(key.e);
writer.writeBuffer(d, 2);
writer.writeBuffer(p, 2);
writer.writeBuffer(q, 2);
writer.writeBuffer(dmp1, 2);
writer.writeBuffer(dmq1, 2);
writer.writeBuffer(coeff, 2);
writer.endSequence();
if (options.type === 'der') {
return writer.buffer;
} else {
return PRIVATE_OPENING_BOUNDARY + '\n' + utils.linebrk(writer.buffer.toString('base64'), 64) + '\n' + PRIVATE_CLOSING_BOUNDARY;
}
},
privateImport: function (key, data, options) {
options = options || {};
var buffer;
if (options.type !== 'der') {
if (Buffer.isBuffer(data)) {
data = data.toString('utf8');
}
if (_.isString(data)) {
var pem = utils.trimSurroundingText(data, PRIVATE_OPENING_BOUNDARY, PRIVATE_CLOSING_BOUNDARY)
.replace(/\s+|\n\r|\n|\r$/gm, '');
buffer = Buffer.from(pem, 'base64');
} else {
throw Error('Unsupported key format');
}
} else if (Buffer.isBuffer(data)) {
buffer = data;
} else {
throw Error('Unsupported key format');
}
var reader = new ber.Reader(buffer);
reader.readSequence();
reader.readString(2, true); // just zero
key.setPrivate(
reader.readString(2, true), // modulus
reader.readString(2, true), // publicExponent
reader.readString(2, true), // privateExponent
reader.readString(2, true), // prime1
reader.readString(2, true), // prime2
reader.readString(2, true), // exponent1 -- d mod (p1)
reader.readString(2, true), // exponent2 -- d mod (q-1)
reader.readString(2, true) // coefficient -- (inverse of q) mod p
);
},
publicExport: function (key, options) {
options = options || {};
var n = key.n.toBuffer();
var length = n.length + 512; // magic
var bodyWriter = new ber.Writer({size: length});
bodyWriter.startSequence();
bodyWriter.writeBuffer(n, 2);
bodyWriter.writeInt(key.e);
bodyWriter.endSequence();
if (options.type === 'der') {
return bodyWriter.buffer;
} else {
return PUBLIC_OPENING_BOUNDARY + '\n' + utils.linebrk(bodyWriter.buffer.toString('base64'), 64) + '\n' + PUBLIC_CLOSING_BOUNDARY;
}
},
publicImport: function (key, data, options) {
options = options || {};
var buffer;
if (options.type !== 'der') {
if (Buffer.isBuffer(data)) {
data = data.toString('utf8');
}
if (_.isString(data)) {
var pem = utils.trimSurroundingText(data, PUBLIC_OPENING_BOUNDARY, PUBLIC_CLOSING_BOUNDARY)
.replace(/\s+|\n\r|\n|\r$/gm, '');
buffer = Buffer.from(pem, 'base64');
}
} else if (Buffer.isBuffer(data)) {
buffer = data;
} else {
throw Error('Unsupported key format');
}
var body = new ber.Reader(buffer);
body.readSequence();
key.setPublic(
body.readString(0x02, true), // modulus
body.readString(0x02, true) // publicExponent
);
},
/**
* Trying autodetect and import key
* @param key
* @param data
*/
autoImport: function (key, data) {
// [\S\s]* matches zero or more of any character
if (/^[\S\s]*-----BEGIN RSA PRIVATE KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END RSA PRIVATE KEY-----[\S\s]*$/g.test(data)) {
module.exports.privateImport(key, data);
return true;
}
if (/^[\S\s]*-----BEGIN RSA PUBLIC KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END RSA PUBLIC KEY-----[\S\s]*$/g.test(data)) {
module.exports.publicImport(key, data);
return true;
}
return false;
}
};
| var ber = require('../asn1/index').Ber;
var _ = require('../utils')._;
var utils = require('../utils');
const PRIVATE_OPENING_BOUNDARY = '-----BEGIN RSA PRIVATE KEY-----';
const PRIVATE_CLOSING_BOUNDARY = '-----END RSA PRIVATE KEY-----';
const PUBLIC_OPENING_BOUNDARY = '-----BEGIN RSA PUBLIC KEY-----';
const PUBLIC_CLOSING_BOUNDARY = '-----END RSA PUBLIC KEY-----';
module.exports = {
privateExport: function (key, options) {
options = options || {};
var n = key.n.toBuffer();
var d = key.d.toBuffer();
var p = key.p.toBuffer();
var q = key.q.toBuffer();
var dmp1 = key.dmp1.toBuffer();
var dmq1 = key.dmq1.toBuffer();
var coeff = key.coeff.toBuffer();
var length = n.length + d.length + p.length + q.length + dmp1.length + dmq1.length + coeff.length + 512; // magic
var writer = new ber.Writer({size: length});
writer.startSequence();
writer.writeInt(0);
writer.writeBuffer(n, 2);
writer.writeInt(key.e);
writer.writeBuffer(d, 2);
writer.writeBuffer(p, 2);
writer.writeBuffer(q, 2);
writer.writeBuffer(dmp1, 2);
writer.writeBuffer(dmq1, 2);
writer.writeBuffer(coeff, 2);
writer.endSequence();
if (options.type === 'der') {
return writer.buffer;
} else {
return PRIVATE_OPENING_BOUNDARY + '\n' + utils.linebrk(writer.buffer.toString('base64'), 64) + '\n' + PRIVATE_CLOSING_BOUNDARY;
}
},
privateImport: function (key, data, options) {
options = options || {};
var buffer;
if (options.type !== 'der') {
if (Buffer.isBuffer(data)) {
data = data.toString('utf8');
}
if (_.isString(data)) {
var pem = utils.trimSurroundingText(data, PRIVATE_OPENING_BOUNDARY, PRIVATE_CLOSING_BOUNDARY)
.replace(/\s+|\n\r|\n|\r$/gm, '');
buffer = Buffer.from(pem, 'base64');
} else {
throw Error('Unsupported key format');
}
} else if (Buffer.isBuffer(data)) {
buffer = data;
} else {
throw Error('Unsupported key format');
}
var reader = new ber.Reader(buffer);
reader.readSequence();
reader.readString(2, true); // just zero
key.setPrivate(
reader.readString(2, true), // modulus
reader.readString(2, true), // publicExponent
reader.readString(2, true), // privateExponent
reader.readString(2, true), // prime1
reader.readString(2, true), // prime2
reader.readString(2, true), // exponent1 -- d mod (p1)
reader.readString(2, true), // exponent2 -- d mod (q-1)
reader.readString(2, true) // coefficient -- (inverse of q) mod p
);
},
publicExport: function (key, options) {
options = options || {};
var n = key.n.toBuffer();
var length = n.length + 512; // magic
var bodyWriter = new ber.Writer({size: length});
bodyWriter.startSequence();
bodyWriter.writeBuffer(n, 2);
bodyWriter.writeInt(key.e);
bodyWriter.endSequence();
if (options.type === 'der') {
return bodyWriter.buffer;
} else {
return PUBLIC_OPENING_BOUNDARY + '\n' + utils.linebrk(bodyWriter.buffer.toString('base64'), 64) + '\n' + PUBLIC_CLOSING_BOUNDARY;
}
},
publicImport: function (key, data, options) {
options = options || {};
var buffer;
if (options.type !== 'der') {
if (Buffer.isBuffer(data)) {
data = data.toString('utf8');
}
if (_.isString(data)) {
var pem = utils.trimSurroundingText(data, PUBLIC_OPENING_BOUNDARY, PUBLIC_CLOSING_BOUNDARY)
.replace(/\s+|\n\r|\n|\r$/gm, '');
buffer = Buffer.from(pem, 'base64');
}
} else if (Buffer.isBuffer(data)) {
buffer = data;
} else {
throw Error('Unsupported key format');
}
var body = new ber.Reader(buffer);
body.readSequence();
key.setPublic(
body.readString(0x02, true), // modulus
body.readString(0x02, true) // publicExponent
);
},
/**
* Trying autodetect and import key
* @param key
* @param data
*/
autoImport: function (key, data) {
// [\S\s]* matches zero or more of any character
if (/^[\S\s]*-----BEGIN RSA PRIVATE KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END RSA PRIVATE KEY-----[\S\s]*$/g.test(data)) {
module.exports.privateImport(key, data);
return true;
}
if (/^[\S\s]*-----BEGIN RSA PUBLIC KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END RSA PUBLIC KEY-----[\S\s]*$/g.test(data)) {
module.exports.publicImport(key, data);
return true;
}
return false;
}
};
| -1 |
ccxt/ccxt | 8,318 | SBTC mapping | https://coinmarketcap.com/currencies/sbtc/markets/
https://coinmarketcap.com/currencies/super-bitcoin/
https://www.coingecko.com/en/coins/siambitcoin | ndubel | "2021-01-21T10:35:23" | "2021-01-21T20:04:45" | 2614db0ebd43f3cf9e1222bde6cefbabb955f681 | 05f5feeaaac3d213bc1314ba47b814db9ac30852 | SBTC mapping. https://coinmarketcap.com/currencies/sbtc/markets/
https://coinmarketcap.com/currencies/super-bitcoin/
https://www.coingecko.com/en/coins/siambitcoin | ./php/bitcoincom.php | <?php
namespace ccxt;
// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
use Exception; // a common import
class bitcoincom extends hitbtc {
public function describe() {
return $this->deep_extend(parent::describe (), array(
'id' => 'bitcoincom',
'name' => 'bitcoin.com',
'countries' => array( 'KN' ),
'urls' => array(
'logo' => 'https://user-images.githubusercontent.com/1294454/97296144-514fa300-1861-11eb-952b-3d55d492200b.jpg',
'api' => array(
'public' => 'https://api.exchange.bitcoin.com',
'private' => 'https://api.exchange.bitcoin.com',
),
'www' => 'https://exchange.bitcoin.com',
'doc' => 'https://api.exchange.bitcoin.com/api/2/explore',
'fees' => 'https://exchange.bitcoin.com/fees-and-limits',
'referral' => 'https://exchange.bitcoin.com/referral/da948b21d6c92d69',
),
'fees' => array(
'trading' => array(
'maker' => 0.15 / 100,
'taker' => 0.2 / 100,
),
),
));
}
}
| <?php
namespace ccxt;
// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
use Exception; // a common import
class bitcoincom extends hitbtc {
public function describe() {
return $this->deep_extend(parent::describe (), array(
'id' => 'bitcoincom',
'name' => 'bitcoin.com',
'countries' => array( 'KN' ),
'urls' => array(
'logo' => 'https://user-images.githubusercontent.com/1294454/97296144-514fa300-1861-11eb-952b-3d55d492200b.jpg',
'api' => array(
'public' => 'https://api.exchange.bitcoin.com',
'private' => 'https://api.exchange.bitcoin.com',
),
'www' => 'https://exchange.bitcoin.com',
'doc' => 'https://api.exchange.bitcoin.com/api/2/explore',
'fees' => 'https://exchange.bitcoin.com/fees-and-limits',
'referral' => 'https://exchange.bitcoin.com/referral/da948b21d6c92d69',
),
'fees' => array(
'trading' => array(
'maker' => 0.15 / 100,
'taker' => 0.2 / 100,
),
),
));
}
}
| -1 |
ccxt/ccxt | 8,318 | SBTC mapping | https://coinmarketcap.com/currencies/sbtc/markets/
https://coinmarketcap.com/currencies/super-bitcoin/
https://www.coingecko.com/en/coins/siambitcoin | ndubel | "2021-01-21T10:35:23" | "2021-01-21T20:04:45" | 2614db0ebd43f3cf9e1222bde6cefbabb955f681 | 05f5feeaaac3d213bc1314ba47b814db9ac30852 | SBTC mapping. https://coinmarketcap.com/currencies/sbtc/markets/
https://coinmarketcap.com/currencies/super-bitcoin/
https://www.coingecko.com/en/coins/siambitcoin | ./python/ccxt/vbtc.py | # -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.foxbit import foxbit
class vbtc(foxbit):
def describe(self):
return self.deep_extend(super(vbtc, self).describe(), {
'id': 'vbtc',
'name': 'VBTC',
'countries': ['VN'],
'has': {
'CORS': False,
},
'urls': {
'logo': 'https://user-images.githubusercontent.com/1294454/27991481-1f53d1d8-6481-11e7-884e-21d17e7939db.jpg',
'api': {
'public': 'https://api.blinktrade.com/api',
'private': 'https://api.blinktrade.com/tapi',
},
'www': 'https://vbtc.exchange',
'doc': 'https://blinktrade.com/docs',
},
'options': {
'brokerId': '3', # https://blinktrade.com/docs/#brokers
},
})
| # -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.foxbit import foxbit
class vbtc(foxbit):
def describe(self):
return self.deep_extend(super(vbtc, self).describe(), {
'id': 'vbtc',
'name': 'VBTC',
'countries': ['VN'],
'has': {
'CORS': False,
},
'urls': {
'logo': 'https://user-images.githubusercontent.com/1294454/27991481-1f53d1d8-6481-11e7-884e-21d17e7939db.jpg',
'api': {
'public': 'https://api.blinktrade.com/api',
'private': 'https://api.blinktrade.com/tapi',
},
'www': 'https://vbtc.exchange',
'doc': 'https://blinktrade.com/docs',
},
'options': {
'brokerId': '3', # https://blinktrade.com/docs/#brokers
},
})
| -1 |
ccxt/ccxt | 8,318 | SBTC mapping | https://coinmarketcap.com/currencies/sbtc/markets/
https://coinmarketcap.com/currencies/super-bitcoin/
https://www.coingecko.com/en/coins/siambitcoin | ndubel | "2021-01-21T10:35:23" | "2021-01-21T20:04:45" | 2614db0ebd43f3cf9e1222bde6cefbabb955f681 | 05f5feeaaac3d213bc1314ba47b814db9ac30852 | SBTC mapping. https://coinmarketcap.com/currencies/sbtc/markets/
https://coinmarketcap.com/currencies/super-bitcoin/
https://www.coingecko.com/en/coins/siambitcoin | ./examples/js/binance-fetch-all-deposits.js | "use strict";
const ccxt = require ('../../ccxt.js')
;(async function main () {
const exchange = new ccxt.binance ({
'apiKey': 'YOUR_API_KEY',
'secret': 'YOUR_SECRET',
'enableRateLimit': true,
})
await exchange.loadMarkets ()
// exchange.verbose = true // uncomment for debugging
const ninetyDays = 90 * 24 * 60 * 60 * 1000;
let startTime = exchange.parse8601 ('2018-01-01T00:00:00')
const now = exchange.milliseconds ()
const currencyCode = undefined // any currency
let allTransactions = []
while (startTime < now) {
const endTime = startTime + ninetyDays
const transactions = await exchange.fetchDeposits (currencyCode, startTime, undefined, {
'endTime': endTime,
})
if (transactions.length) {
const lastTransaction = transactions[transactions.length - 1]
startTime = lastTransaction['timestamp'] + 1
allTransactions = allTransactions.concat (transactions)
} else {
startTime = endTime;
}
}
console.log ('Fetched', allTransactions.length, 'transactions')
for (let i = 0; i < allTransactions.length; i++) {
const transaction = allTransactions[i]
console.log (i, transaction['datetime'], transaction['txid'], transaction['currency'], transaction['amount'])
}
}) () | "use strict";
const ccxt = require ('../../ccxt.js')
;(async function main () {
const exchange = new ccxt.binance ({
'apiKey': 'YOUR_API_KEY',
'secret': 'YOUR_SECRET',
'enableRateLimit': true,
})
await exchange.loadMarkets ()
// exchange.verbose = true // uncomment for debugging
const ninetyDays = 90 * 24 * 60 * 60 * 1000;
let startTime = exchange.parse8601 ('2018-01-01T00:00:00')
const now = exchange.milliseconds ()
const currencyCode = undefined // any currency
let allTransactions = []
while (startTime < now) {
const endTime = startTime + ninetyDays
const transactions = await exchange.fetchDeposits (currencyCode, startTime, undefined, {
'endTime': endTime,
})
if (transactions.length) {
const lastTransaction = transactions[transactions.length - 1]
startTime = lastTransaction['timestamp'] + 1
allTransactions = allTransactions.concat (transactions)
} else {
startTime = endTime;
}
}
console.log ('Fetched', allTransactions.length, 'transactions')
for (let i = 0; i < allTransactions.length; i++) {
const transaction = allTransactions[i]
console.log (i, transaction['datetime'], transaction['txid'], transaction['currency'], transaction['amount'])
}
}) () | -1 |
ccxt/ccxt | 8,318 | SBTC mapping | https://coinmarketcap.com/currencies/sbtc/markets/
https://coinmarketcap.com/currencies/super-bitcoin/
https://www.coingecko.com/en/coins/siambitcoin | ndubel | "2021-01-21T10:35:23" | "2021-01-21T20:04:45" | 2614db0ebd43f3cf9e1222bde6cefbabb955f681 | 05f5feeaaac3d213bc1314ba47b814db9ac30852 | SBTC mapping. https://coinmarketcap.com/currencies/sbtc/markets/
https://coinmarketcap.com/currencies/super-bitcoin/
https://www.coingecko.com/en/coins/siambitcoin | ./doc/.gitignore | _build
| _build
| -1 |
ccxt/ccxt | 8,318 | SBTC mapping | https://coinmarketcap.com/currencies/sbtc/markets/
https://coinmarketcap.com/currencies/super-bitcoin/
https://www.coingecko.com/en/coins/siambitcoin | ndubel | "2021-01-21T10:35:23" | "2021-01-21T20:04:45" | 2614db0ebd43f3cf9e1222bde6cefbabb955f681 | 05f5feeaaac3d213bc1314ba47b814db9ac30852 | SBTC mapping. https://coinmarketcap.com/currencies/sbtc/markets/
https://coinmarketcap.com/currencies/super-bitcoin/
https://www.coingecko.com/en/coins/siambitcoin | ./python/ccxt/async_support/bcex.py | # -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.base.exchange import Exchange
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import AuthenticationError
from ccxt.base.errors import ArgumentsRequired
from ccxt.base.errors import InsufficientFunds
from ccxt.base.errors import InvalidOrder
from ccxt.base.errors import OrderNotFound
class bcex(Exchange):
def describe(self):
return self.deep_extend(super(bcex, self).describe(), {
'id': 'bcex',
'name': 'BCEX',
'countries': ['CN', 'HK'],
'version': '1',
'has': {
'cancelOrder': True,
'createOrder': True,
'fetchBalance': True,
'fetchClosedOrders': 'emulated',
'fetchMarkets': True,
'fetchMyTrades': True,
'fetchOpenOrders': True,
'fetchOrder': True,
'fetchOrders': True,
'fetchOrderBook': True,
'fetchTicker': True,
'fetchTickers': False,
'fetchTrades': True,
'fetchTradingLimits': True,
},
'urls': {
'logo': 'https://user-images.githubusercontent.com/51840849/77231516-851c6900-6bac-11ea-8fd6-ee5c23eddbd4.jpg',
'api': 'https://www.bcex.top',
'www': 'https://www.bcex.top',
'doc': 'https://github.com/BCEX-TECHNOLOGY-LIMITED/API_Docs/wiki/Interface',
'fees': 'https://bcex.udesk.cn/hc/articles/57085',
'referral': 'https://www.bcex.top/register?invite_code=758978&lang=en',
},
'status': {
'status': 'error',
'updated': None,
'eta': None,
'url': None,
},
'api': {
'public': {
'get': [
'Api_Market/getPriceList', # tickers
'Api_Order/ticker', # last ohlcv candle(ticker)
'Api_Order/depth', # orderbook
'Api_Market/getCoinTrade', # ticker
'Api_Order/marketOrder', # trades...
],
'post': [
'Api_Market/getPriceList', # tickers
'Api_Order/ticker', # last ohlcv candle(ticker)
'Api_Order/depth', # orderbook
'Api_Market/getCoinTrade', # ticker
'Api_Order/marketOrder', # trades...
],
},
'private': {
'post': [
'Api_Order/cancel',
'Api_Order/coinTrust', # limit order
'Api_Order/orderList', # open / all orders(my trades?)
'Api_Order/orderInfo',
'Api_Order/tradeList', # open / all orders
'Api_Order/trustList', # ?
'Api_User/userBalance',
],
},
},
'fees': {
'trading': {
'tierBased': False,
'percentage': True,
'maker': 0.1 / 100,
'taker': 0.2 / 100,
},
'funding': {
'tierBased': False,
'percentage': False,
'withdraw': {
'ckusd': 0.0,
'other': 0.05 / 100,
},
'deposit': {},
},
},
'exceptions': {
'该币不存在,非法操作': ExchangeError, # {code: 1, msg: "该币不存在,非法操作"} - returned when a required symbol parameter is missing in the request(also, maybe on other types of errors as well)
'公钥不合法': AuthenticationError, # {code: 1, msg: '公钥不合法'} - wrong public key
'您的可用余额不足': InsufficientFunds, # {code: 1, msg: '您的可用余额不足'} - your available balance is insufficient
'您的btc不足': InsufficientFunds, # {code: 1, msg: '您的btc不足'} - your btc is insufficient
'参数非法': InvalidOrder, # {'code': 1, 'msg': '参数非法'} - 'Parameter illegal'
'订单信息不存在': OrderNotFound, # {'code': 1, 'msg': '订单信息不存在'} - 'Order information does not exist'
},
'commonCurrencies': {
'UNI': 'UNI COIN',
'PNT': 'Penta',
},
'options': {
'limits': {
# hardcoding is deprecated, using these predefined values is not recommended, use loadTradingLimits instead
'AFC/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 6, 'max': 120000}}},
'AFC/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 6, 'max': 120000}}},
'AFT/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 15, 'max': 300000}}},
'AICC/CNET': {'precision': {'amount': 2, 'price': 2}, 'limits': {'amount': {'min': 5, 'max': 50000}}},
'AIDOC/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 5, 'max': 100000}}},
'AISI/ETH': {'precision': {'amount': 4, 'price': 2}, 'limits': {'amount': {'min': 0.001, 'max': 500}}},
'AIT/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 20, 'max': 400000}}},
'ANS/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 0.1, 'max': 500}}},
'ANS/CKUSD': {'precision': {'amount': 2, 'price': 2}, 'limits': {'amount': {'min': 0.1, 'max': 1000}}},
'ARC/CNET': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 60, 'max': 600000}}},
'AXF/CNET': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 100, 'max': 1000000}}},
'BASH/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 250, 'max': 3000000}}},
'BATT/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 60, 'max': 1500000}}},
'BCD/BTC': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 0.3, 'max': 7000}}},
'BHPC/BTC': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 2, 'max': 70000}}},
'BHPC/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 2, 'max': 60000}}},
'BOPO/BTC': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 100, 'max': 2000000}}},
'BOPO/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 100, 'max': 10000000}}},
'BTC/CKUSD': {'precision': {'amount': 4, 'price': 2}, 'limits': {'amount': {'min': 0.001, 'max': 10}}},
'BTC/CNET': {'precision': {'amount': 4, 'price': 2}, 'limits': {'amount': {'min': 0.0005, 'max': 5}}},
'BTC/USDT': {'precision': {'amount': 4, 'price': 2}, 'limits': {'amount': {'min': 0.0002, 'max': 4}}},
'BTE/CNET': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 25, 'max': 250000}}},
'BU/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 20, 'max': 400000}}},
'CIC/CNET': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 3000, 'max': 30000000}}},
'CIT/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 4, 'max': 40000}}},
'CIT/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 4, 'max': 40000}}},
'CMT/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 5, 'max': 2500000}}},
'CNET/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 12, 'max': 120000}}},
'CNMC/BTC': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 4, 'max': 50000}}},
'CTC/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 5, 'max': 550000}}},
'CZR/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 12, 'max': 500000}}},
'DCON/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 8, 'max': 300000}}},
'DCT/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 2, 'max': 40000}}},
'DCT/CKUSD': {'precision': {'amount': 2, 'price': 3}, 'limits': {'amount': {'min': 2, 'max': 2000}}},
'DOGE/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 3000, 'max': 14000000}}},
'DOGE/CKUSD': {'precision': {'amount': 2, 'price': 6}, 'limits': {'amount': {'min': 500, 'max': 2000000}}},
'DRCT/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 16, 'max': 190000}}},
'ELA/BTC': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 0.02, 'max': 500}}},
'ELF/BTC': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 0.1, 'max': 100000}}},
'ELF/CKUSD': {'precision': {'amount': 2, 'price': 3}, 'limits': {'amount': {'min': 0.01, 'max': 100000}}},
'EOS/CKUSD': {'precision': {'amount': 2, 'price': 2}, 'limits': {'amount': {'min': 0.5, 'max': 5000}}},
'EOS/CNET': {'precision': {'amount': 2, 'price': 2}, 'limits': {'amount': {'min': 2.5, 'max': 30000}}},
'EOS/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 0.18, 'max': 1800}}},
'ETC/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 0.2, 'max': 2500}}},
'ETC/CKUSD': {'precision': {'amount': 2, 'price': 2}, 'limits': {'amount': {'min': 0.2, 'max': 2500}}},
'ETF/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 7, 'max': 150000}}},
'ETH/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 0.015, 'max': 100}}},
'ETH/CKUSD': {'precision': {'amount': 4, 'price': 4}, 'limits': {'amount': {'min': 0.005, 'max': 100}}},
'ETH/USDT': {'precision': {'amount': 4, 'price': 2}, 'limits': {'amount': {'min': 0.005, 'max': 100}}},
'FCT/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 0.24, 'max': 1000}}},
'FCT/CKUSD': {'precision': {'amount': 2, 'price': 2}, 'limits': {'amount': {'min': 0.24, 'max': 1000}}},
'GAME/CNET': {'precision': {'amount': 2, 'price': 2}, 'limits': {'amount': {'min': 1, 'max': 10000}}},
'GOOC/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 200, 'max': 2000000}}},
'GP/CNET': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 600, 'max': 6000000}}},
'HSC/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 1000, 'max': 20000000}}},
'IFISH/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 300, 'max': 8000000}}},
'IIC/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 50, 'max': 4000000}}},
'IMOS/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 15, 'max': 300000}}},
'JC/CNET': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 300, 'max': 3000000}}},
'LBTC/BTC': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 0.1, 'max': 3000}}},
'LEC/CNET': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 500, 'max': 5000000}}},
'LKY/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 10, 'max': 70000}}},
'LKY/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 10, 'max': 100000}}},
'LMC/CNET': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 25, 'max': 250000}}},
'LSK/CNET': {'precision': {'amount': 2, 'price': 2}, 'limits': {'amount': {'min': 0.3, 'max': 3000}}},
'LTC/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 0.01, 'max': 500}}},
'LTC/CKUSD': {'precision': {'amount': 2, 'price': 2}, 'limits': {'amount': {'min': 0.01, 'max': 500}}},
'LTC/USDT': {'precision': {'amount': 4, 'price': 2}, 'limits': {'amount': {'min': 0.02, 'max': 450}}},
'MC/CNET': {'precision': {'amount': 2, 'price': 6}, 'limits': {'amount': {'min': 10000, 'max': 100000000}}},
'MCC/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 30, 'max': 350000}}},
'MOC/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 25, 'max': 600000}}},
'MRYC/CNET': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 300, 'max': 3000000}}},
'MT/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 200, 'max': 6000000}}},
'MXI/CNET': {'precision': {'amount': 2, 'price': 6}, 'limits': {'amount': {'min': 5000, 'max': 60000000}}},
'NAI/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 10, 'max': 100000}}},
'NAS/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 0.2, 'max': 15000}}},
'NAS/CKUSD': {'precision': {'amount': 2, 'price': 2}, 'limits': {'amount': {'min': 0.5, 'max': 5000}}},
'NEWOS/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 65, 'max': 700000}}},
'NKN/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 3, 'max': 350000}}},
'NTK/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 2, 'max': 30000}}},
'ONT/CKUSD': {'precision': {'amount': 2, 'price': 3}, 'limits': {'amount': {'min': 0.2, 'max': 2000}}},
'ONT/ETH': {'precision': {'amount': 3, 'price': 8}, 'limits': {'amount': {'min': 0.01, 'max': 1000}}},
'PNT/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 80, 'max': 800000}}},
'PST/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 5, 'max': 100000}}},
'PTT/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 450, 'max': 10000000}}},
'QTUM/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 0.4, 'max': 2800}}},
'QTUM/CKUSD': {'precision': {'amount': 2, 'price': 2}, 'limits': {'amount': {'min': 0.1, 'max': 1000}}},
'RATING/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 500, 'max': 10000000}}},
'RHC/CNET': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 1000, 'max': 10000000}}},
'SDA/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 20, 'max': 500000}}},
'SDD/CKUSD': {'precision': {'amount': 2, 'price': 3}, 'limits': {'amount': {'min': 10, 'max': 100000}}},
'SHC/CNET': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 250, 'max': 2500000}}},
'SHE/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 100, 'max': 5000000}}},
'SMC/CNET': {'precision': {'amount': 2, 'price': 6}, 'limits': {'amount': {'min': 1000, 'max': 10000000}}},
'SOP/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 50, 'max': 1000000}}},
'TAC/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 35, 'max': 800000}}},
'TIP/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 7, 'max': 200000}}},
'TKT/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 40, 'max': 400000}}},
'TLC/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 500, 'max': 10000000}}},
'TNC/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 10, 'max': 110000}}},
'TUB/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 200, 'max': 8000000}}},
'UC/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 100, 'max': 3000000}}},
'UDB/CNET': {'precision': {'amount': 2, 'price': 6}, 'limits': {'amount': {'min': 2000, 'max': 40000000}}},
'UIC/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 5, 'max': 150000}}},
'VAAC/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 10, 'max': 250000}}},
'VPN/CNET': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 200, 'max': 2000000}}},
'VSC/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 30, 'max': 650000}}},
'WAVES/CKUSD': {'precision': {'amount': 2, 'price': 3}, 'limits': {'amount': {'min': 0.15, 'max': 1500}}},
'WDNA/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 100, 'max': 250000}}},
'WIC/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 3, 'max': 30000}}},
'XAS/CNET': {'precision': {'amount': 2, 'price': 2}, 'limits': {'amount': {'min': 2.5, 'max': 25000}}},
'XLM/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 10, 'max': 300000}}},
'XLM/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 1, 'max': 300000}}},
'XLM/USDT': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 5, 'max': 150000}}},
'XRP/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 24, 'max': 100000}}},
'XRP/CKUSD': {'precision': {'amount': 2, 'price': 3}, 'limits': {'amount': {'min': 5, 'max': 50000}}},
'YBCT/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 15, 'max': 200000}}},
'YBCT/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 10, 'max': 200000}}},
'YBY/CNET': {'precision': {'amount': 2, 'price': 6}, 'limits': {'amount': {'min': 25000, 'max': 250000000}}},
'ZEC/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 0.02, 'max': 100}}},
'ZEC/CKUSD': {'precision': {'amount': 4, 'price': 2}, 'limits': {'amount': {'min': 0.02, 'max': 100}}},
},
},
})
async def fetch_trading_limits(self, symbols=None, params={}):
# self method should not be called directly, use loadTradingLimits() instead
# by default it will try load withdrawal fees of all currencies(with separate requests, sequentially)
# however if you define symbols = ['ETH/BTC', 'LTC/BTC'] in args it will only load those
await self.load_markets()
if symbols is None:
symbols = self.symbols
result = {}
for i in range(0, len(symbols)):
symbol = symbols[i]
result[symbol] = await self.fetch_trading_limits_by_id(self.market_id(symbol), params)
return result
async def fetch_trading_limits_by_id(self, id, params={}):
request = {
'symbol': id,
}
response = await self.publicPostApiOrderTicker(self.extend(request, params))
#
# { code: 0,
# msg: "获取牌价信息成功",
# data: { high: 0.03721392,
# low: 0.03335362,
# buy: "0.03525757",
# sell: "0.03531160",
# last: 0.0352634,
# vol: "184742.4176",
# min_trade: "0.01500000",
# max_trade: "100.00000000",
# number_float: "4",
# price_float: "8" }}}
#
return self.parse_trading_limits(self.safe_value(response, 'data', {}))
def parse_trading_limits(self, limits, symbol=None, params={}):
#
# { high: 0.03721392,
# low: 0.03335362,
# buy: "0.03525757",
# sell: "0.03531160",
# last: 0.0352634,
# vol: "184742.4176",
# min_trade: "0.01500000",
# max_trade: "100.00000000",
# number_float: "4",
# price_float: "8" }
#
return {
'info': limits,
'precision': {
'amount': self.safe_integer(limits, 'number_float'),
'price': self.safe_integer(limits, 'price_float'),
},
'limits': {
'amount': {
'min': self.safe_float(limits, 'min_trade'),
'max': self.safe_float(limits, 'max_trade'),
},
},
}
async def fetch_markets(self, params={}):
response = await self.publicGetApiMarketGetPriceList(params)
result = []
keys = list(response.keys())
for i in range(0, len(keys)):
currentMarketId = keys[i]
currentMarkets = response[currentMarketId]
for j in range(0, len(currentMarkets)):
market = currentMarkets[j]
baseId = self.safe_string(market, 'coin_from')
quoteId = self.safe_string(market, 'coin_to')
base = baseId.upper()
quote = quoteId.upper()
base = self.safe_currency_code(base)
quote = self.safe_currency_code(quote)
id = baseId + '2' + quoteId
symbol = base + '/' + quote
active = True
defaults = self.safe_value(self.options['limits'], symbol, {})
result.append(self.extend({
'id': id,
'symbol': symbol,
'base': base,
'quote': quote,
'baseId': baseId,
'quoteId': quoteId,
'active': active,
# overrided by defaults from self.options['limits']
'precision': {
'amount': None,
'price': None,
},
# overrided by defaults from self.options['limits']
'limits': {
'amount': {'min': None, 'max': None},
'price': {'min': None, 'max': None},
'cost': {'min': None, 'max': None},
},
'info': market,
}, defaults))
return result
def parse_trade(self, trade, market=None):
symbol = None
if market is not None:
symbol = market['symbol']
timestamp = self.safe_timestamp_2(trade, 'date', 'created')
id = self.safe_string(trade, 'tid')
orderId = self.safe_string(trade, 'order_id')
amount = self.safe_float_2(trade, 'number', 'amount')
price = self.safe_float(trade, 'price')
cost = None
if price is not None:
if amount is not None:
cost = amount * price
side = self.safe_string(trade, 'side')
if side == 'sale':
side = 'sell'
return {
'info': trade,
'id': id,
'timestamp': timestamp,
'datetime': self.iso8601(timestamp),
'symbol': symbol,
'type': None,
'side': side,
'price': price,
'amount': amount,
'cost': cost,
'order': orderId,
'fee': None,
'takerOrMaker': None,
}
async def fetch_trades(self, symbol, since=None, limit=None, params={}):
await self.load_markets()
request = {
'symbol': self.market_id(symbol),
}
if limit is not None:
request['limit'] = limit
market = self.market(symbol)
response = await self.publicPostApiOrderMarketOrder(self.extend(request, params))
return self.parse_trades(response['data'], market, since, limit)
async def fetch_balance(self, params={}):
await self.load_markets()
response = await self.privatePostApiUserUserBalance(params)
data = self.safe_value(response, 'data')
keys = list(data.keys())
result = {}
for i in range(0, len(keys)):
key = keys[i]
amount = self.safe_float(data, key)
parts = key.split('_')
currencyId = parts[0]
lockOrOver = parts[1]
code = self.safe_currency_code(currencyId)
if not (code in result):
result[code] = self.account()
if lockOrOver == 'lock':
result[code]['used'] = float(amount)
else:
result[code]['free'] = float(amount)
keys = list(result.keys())
for i in range(0, len(keys)):
key = keys[i]
total = self.sum(result[key]['used'], result[key]['free'])
result[key]['total'] = total
result['info'] = data
return self.parse_balance(result)
async def fetch_ticker(self, symbol, params={}):
await self.load_markets()
market = self.markets[symbol]
request = {
'part': market['quoteId'],
'coin': market['baseId'],
}
response = await self.publicPostApiMarketGetCoinTrade(self.extend(request, params))
timestamp = self.milliseconds()
return {
'symbol': symbol,
'timestamp': timestamp,
'datetime': self.iso8601(timestamp),
'high': self.safe_float(response, 'max'),
'low': self.safe_float(response, 'min'),
'bid': self.safe_float(response, 'buy'),
'bidVolume': None,
'ask': self.safe_float(response, 'sale'),
'askVolume': None,
'vwap': None,
'open': None,
'close': self.safe_float(response, 'price'),
'last': self.safe_float(response, 'price'),
'previousClose': None,
'change': None,
'percentage': self.safe_float(response, 'change_24h'),
'average': None,
'baseVolume': self.safe_float(response, 'volume_24h'),
'quoteVolume': None,
'info': response,
}
async def fetch_order_book(self, symbol, limit=None, params={}):
await self.load_markets()
marketId = self.market_id(symbol)
request = {
'symbol': marketId,
}
response = await self.publicPostApiOrderDepth(self.extend(request, params))
data = self.safe_value(response, 'data')
timestamp = self.safe_timestamp(data, 'date')
return self.parse_order_book(data, timestamp)
async def fetch_my_trades(self, symbol=None, since=None, limit=None, params={}):
await self.load_markets()
market = self.market(symbol)
request = {
'symbol': market['id'],
}
response = await self.privatePostApiOrderOrderList(self.extend(request, params))
return self.parse_trades(response['data'], market, since, limit)
def parse_order_status(self, status):
statuses = {
'0': 'open',
'1': 'open', # partially filled
'2': 'closed',
'3': 'canceled',
}
return self.safe_string(statuses, status, status)
async def fetch_order(self, id, symbol=None, params={}):
if symbol is None:
raise ArgumentsRequired(self.id + ' fetchOrder requires a `symbol` argument')
await self.load_markets()
request = {
'symbol': self.market_id(symbol),
'trust_id': id,
}
response = await self.privatePostApiOrderOrderInfo(self.extend(request, params))
order = self.safe_value(response, 'data')
timestamp = self.safe_timestamp(order, 'created')
status = self.parse_order_status(self.safe_string(order, 'status'))
side = self.safe_string(order, 'flag')
if side == 'sale':
side = 'sell'
# Can't use parseOrder because the data format is different btw endpoint for fetchOrder and fetchOrders
return {
'info': order,
'id': id,
'timestamp': timestamp,
'datetime': self.iso8601(timestamp),
'lastTradeTimestamp': None,
'symbol': symbol,
'type': None,
'side': side,
'price': self.safe_float(order, 'price'),
'cost': None,
'average': self.safe_float(order, 'avg_price'),
'amount': self.safe_float(order, 'number'),
'filled': self.safe_float(order, 'numberdeal'),
'remaining': self.safe_float(order, 'numberover'),
'status': status,
'fee': None,
'clientOrderId': None,
'trades': None,
}
def parse_order(self, order, market=None):
id = self.safe_string(order, 'id')
timestamp = self.safe_timestamp(order, 'datetime')
symbol = None
if market is not None:
symbol = market['symbol']
type = None
side = self.safe_string(order, 'type')
if side == 'sale':
side = 'sell'
price = self.safe_float(order, 'price')
average = self.safe_float(order, 'avg_price')
amount = self.safe_float(order, 'amount')
remaining = self.safe_float(order, 'amount_outstanding')
filled = amount - remaining
status = self.parse_order_status(self.safe_string(order, 'status'))
cost = filled * price
fee = None
result = {
'info': order,
'id': id,
'clientOrderId': None,
'timestamp': timestamp,
'datetime': self.iso8601(timestamp),
'lastTradeTimestamp': None,
'symbol': symbol,
'type': type,
'timeInForce': None,
'postOnly': None,
'side': side,
'price': price,
'stopPrice': None,
'cost': cost,
'average': average,
'amount': amount,
'filled': filled,
'remaining': remaining,
'status': status,
'fee': fee,
'trades': None,
}
return result
async def fetch_orders_by_type(self, type, symbol=None, since=None, limit=None, params={}):
await self.load_markets()
request = {
'type': type,
}
market = None
if symbol is not None:
market = self.market(symbol)
request['symbol'] = market['id']
response = await self.privatePostApiOrderTradeList(self.extend(request, params))
if 'data' in response:
return self.parse_orders(response['data'], market, since, limit)
return []
async def fetch_open_orders(self, symbol=None, since=None, limit=None, params={}):
return self.fetch_orders_by_type('open', symbol, since, limit, params)
async def fetch_closed_orders(self, symbol=None, since=None, limit=None, params={}):
orders = await self.fetch_orders(symbol, since, limit, params)
return self.filter_by(orders, 'status', 'closed')
async def fetch_orders(self, symbol=None, since=None, limit=None, params={}):
return self.fetch_orders_by_type('all', symbol, since, limit, params)
async def create_order(self, symbol, type, side, amount, price=None, params={}):
await self.load_markets()
request = {
'symbol': self.market_id(symbol),
'type': side,
'price': self.price_to_precision(symbol, price),
'number': self.amount_to_precision(symbol, amount),
}
response = await self.privatePostApiOrderCoinTrust(self.extend(request, params))
data = self.safe_value(response, 'data', {})
id = self.safe_string(data, 'order_id')
return {
'info': response,
'id': id,
}
async def cancel_order(self, id, symbol=None, params={}):
if symbol is None:
raise ArgumentsRequired(self.id + ' cancelOrder requires a `symbol` argument')
await self.load_markets()
request = {}
if symbol is not None:
request['symbol'] = self.market_id(symbol)
if id is not None:
request['order_id'] = id
return await self.privatePostApiOrderCancel(self.extend(request, params))
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
url = self.urls['api'] + '/' + self.implode_params(path, params)
query = self.omit(params, self.extract_params(path))
if api == 'public':
if query:
url += '?' + self.urlencode(query)
else:
self.check_required_credentials()
payload = self.urlencode({'api_key': self.apiKey})
if query:
payload += '&' + self.urlencode(self.keysort(query))
auth = payload + '&secret_key=' + self.secret
signature = self.hash(self.encode(auth))
body = payload + '&sign=' + signature
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
}
return {'url': url, 'method': method, 'body': body, 'headers': headers}
def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
if response is None:
return # fallback to default error handler
errorCode = self.safe_value(response, 'code')
if errorCode is not None:
if errorCode != 0:
#
# {code: 1, msg: "该币不存在,非法操作"} - returned when a required symbol parameter is missing in the request(also, maybe on other types of errors as well)
# {code: 1, msg: '公钥不合法'} - wrong public key
# {code: 1, msg: '价格输入有误,请检查你的数值精度'} - 'The price input is incorrect, please check your numerical accuracy'
# {code: 1, msg: '单笔最小交易数量不能小于0.00100000,请您重新挂单'} -
# 'The minimum number of single transactions cannot be less than 0.00100000. Please re-post the order'
#
message = self.safe_string(response, 'msg')
feedback = self.id + ' ' + message
self.throw_exactly_matched_exception(self.exceptions, message, feedback)
if message.find('请您重新挂单') >= 0: # minimum limit
raise InvalidOrder(feedback)
else:
raise ExchangeError(feedback)
| # -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.base.exchange import Exchange
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import AuthenticationError
from ccxt.base.errors import ArgumentsRequired
from ccxt.base.errors import InsufficientFunds
from ccxt.base.errors import InvalidOrder
from ccxt.base.errors import OrderNotFound
class bcex(Exchange):
def describe(self):
return self.deep_extend(super(bcex, self).describe(), {
'id': 'bcex',
'name': 'BCEX',
'countries': ['CN', 'HK'],
'version': '1',
'has': {
'cancelOrder': True,
'createOrder': True,
'fetchBalance': True,
'fetchClosedOrders': 'emulated',
'fetchMarkets': True,
'fetchMyTrades': True,
'fetchOpenOrders': True,
'fetchOrder': True,
'fetchOrders': True,
'fetchOrderBook': True,
'fetchTicker': True,
'fetchTickers': False,
'fetchTrades': True,
'fetchTradingLimits': True,
},
'urls': {
'logo': 'https://user-images.githubusercontent.com/51840849/77231516-851c6900-6bac-11ea-8fd6-ee5c23eddbd4.jpg',
'api': 'https://www.bcex.top',
'www': 'https://www.bcex.top',
'doc': 'https://github.com/BCEX-TECHNOLOGY-LIMITED/API_Docs/wiki/Interface',
'fees': 'https://bcex.udesk.cn/hc/articles/57085',
'referral': 'https://www.bcex.top/register?invite_code=758978&lang=en',
},
'status': {
'status': 'error',
'updated': None,
'eta': None,
'url': None,
},
'api': {
'public': {
'get': [
'Api_Market/getPriceList', # tickers
'Api_Order/ticker', # last ohlcv candle(ticker)
'Api_Order/depth', # orderbook
'Api_Market/getCoinTrade', # ticker
'Api_Order/marketOrder', # trades...
],
'post': [
'Api_Market/getPriceList', # tickers
'Api_Order/ticker', # last ohlcv candle(ticker)
'Api_Order/depth', # orderbook
'Api_Market/getCoinTrade', # ticker
'Api_Order/marketOrder', # trades...
],
},
'private': {
'post': [
'Api_Order/cancel',
'Api_Order/coinTrust', # limit order
'Api_Order/orderList', # open / all orders(my trades?)
'Api_Order/orderInfo',
'Api_Order/tradeList', # open / all orders
'Api_Order/trustList', # ?
'Api_User/userBalance',
],
},
},
'fees': {
'trading': {
'tierBased': False,
'percentage': True,
'maker': 0.1 / 100,
'taker': 0.2 / 100,
},
'funding': {
'tierBased': False,
'percentage': False,
'withdraw': {
'ckusd': 0.0,
'other': 0.05 / 100,
},
'deposit': {},
},
},
'exceptions': {
'该币不存在,非法操作': ExchangeError, # {code: 1, msg: "该币不存在,非法操作"} - returned when a required symbol parameter is missing in the request(also, maybe on other types of errors as well)
'公钥不合法': AuthenticationError, # {code: 1, msg: '公钥不合法'} - wrong public key
'您的可用余额不足': InsufficientFunds, # {code: 1, msg: '您的可用余额不足'} - your available balance is insufficient
'您的btc不足': InsufficientFunds, # {code: 1, msg: '您的btc不足'} - your btc is insufficient
'参数非法': InvalidOrder, # {'code': 1, 'msg': '参数非法'} - 'Parameter illegal'
'订单信息不存在': OrderNotFound, # {'code': 1, 'msg': '订单信息不存在'} - 'Order information does not exist'
},
'commonCurrencies': {
'UNI': 'UNI COIN',
'PNT': 'Penta',
},
'options': {
'limits': {
# hardcoding is deprecated, using these predefined values is not recommended, use loadTradingLimits instead
'AFC/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 6, 'max': 120000}}},
'AFC/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 6, 'max': 120000}}},
'AFT/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 15, 'max': 300000}}},
'AICC/CNET': {'precision': {'amount': 2, 'price': 2}, 'limits': {'amount': {'min': 5, 'max': 50000}}},
'AIDOC/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 5, 'max': 100000}}},
'AISI/ETH': {'precision': {'amount': 4, 'price': 2}, 'limits': {'amount': {'min': 0.001, 'max': 500}}},
'AIT/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 20, 'max': 400000}}},
'ANS/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 0.1, 'max': 500}}},
'ANS/CKUSD': {'precision': {'amount': 2, 'price': 2}, 'limits': {'amount': {'min': 0.1, 'max': 1000}}},
'ARC/CNET': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 60, 'max': 600000}}},
'AXF/CNET': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 100, 'max': 1000000}}},
'BASH/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 250, 'max': 3000000}}},
'BATT/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 60, 'max': 1500000}}},
'BCD/BTC': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 0.3, 'max': 7000}}},
'BHPC/BTC': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 2, 'max': 70000}}},
'BHPC/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 2, 'max': 60000}}},
'BOPO/BTC': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 100, 'max': 2000000}}},
'BOPO/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 100, 'max': 10000000}}},
'BTC/CKUSD': {'precision': {'amount': 4, 'price': 2}, 'limits': {'amount': {'min': 0.001, 'max': 10}}},
'BTC/CNET': {'precision': {'amount': 4, 'price': 2}, 'limits': {'amount': {'min': 0.0005, 'max': 5}}},
'BTC/USDT': {'precision': {'amount': 4, 'price': 2}, 'limits': {'amount': {'min': 0.0002, 'max': 4}}},
'BTE/CNET': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 25, 'max': 250000}}},
'BU/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 20, 'max': 400000}}},
'CIC/CNET': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 3000, 'max': 30000000}}},
'CIT/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 4, 'max': 40000}}},
'CIT/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 4, 'max': 40000}}},
'CMT/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 5, 'max': 2500000}}},
'CNET/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 12, 'max': 120000}}},
'CNMC/BTC': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 4, 'max': 50000}}},
'CTC/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 5, 'max': 550000}}},
'CZR/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 12, 'max': 500000}}},
'DCON/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 8, 'max': 300000}}},
'DCT/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 2, 'max': 40000}}},
'DCT/CKUSD': {'precision': {'amount': 2, 'price': 3}, 'limits': {'amount': {'min': 2, 'max': 2000}}},
'DOGE/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 3000, 'max': 14000000}}},
'DOGE/CKUSD': {'precision': {'amount': 2, 'price': 6}, 'limits': {'amount': {'min': 500, 'max': 2000000}}},
'DRCT/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 16, 'max': 190000}}},
'ELA/BTC': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 0.02, 'max': 500}}},
'ELF/BTC': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 0.1, 'max': 100000}}},
'ELF/CKUSD': {'precision': {'amount': 2, 'price': 3}, 'limits': {'amount': {'min': 0.01, 'max': 100000}}},
'EOS/CKUSD': {'precision': {'amount': 2, 'price': 2}, 'limits': {'amount': {'min': 0.5, 'max': 5000}}},
'EOS/CNET': {'precision': {'amount': 2, 'price': 2}, 'limits': {'amount': {'min': 2.5, 'max': 30000}}},
'EOS/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 0.18, 'max': 1800}}},
'ETC/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 0.2, 'max': 2500}}},
'ETC/CKUSD': {'precision': {'amount': 2, 'price': 2}, 'limits': {'amount': {'min': 0.2, 'max': 2500}}},
'ETF/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 7, 'max': 150000}}},
'ETH/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 0.015, 'max': 100}}},
'ETH/CKUSD': {'precision': {'amount': 4, 'price': 4}, 'limits': {'amount': {'min': 0.005, 'max': 100}}},
'ETH/USDT': {'precision': {'amount': 4, 'price': 2}, 'limits': {'amount': {'min': 0.005, 'max': 100}}},
'FCT/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 0.24, 'max': 1000}}},
'FCT/CKUSD': {'precision': {'amount': 2, 'price': 2}, 'limits': {'amount': {'min': 0.24, 'max': 1000}}},
'GAME/CNET': {'precision': {'amount': 2, 'price': 2}, 'limits': {'amount': {'min': 1, 'max': 10000}}},
'GOOC/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 200, 'max': 2000000}}},
'GP/CNET': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 600, 'max': 6000000}}},
'HSC/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 1000, 'max': 20000000}}},
'IFISH/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 300, 'max': 8000000}}},
'IIC/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 50, 'max': 4000000}}},
'IMOS/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 15, 'max': 300000}}},
'JC/CNET': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 300, 'max': 3000000}}},
'LBTC/BTC': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 0.1, 'max': 3000}}},
'LEC/CNET': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 500, 'max': 5000000}}},
'LKY/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 10, 'max': 70000}}},
'LKY/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 10, 'max': 100000}}},
'LMC/CNET': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 25, 'max': 250000}}},
'LSK/CNET': {'precision': {'amount': 2, 'price': 2}, 'limits': {'amount': {'min': 0.3, 'max': 3000}}},
'LTC/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 0.01, 'max': 500}}},
'LTC/CKUSD': {'precision': {'amount': 2, 'price': 2}, 'limits': {'amount': {'min': 0.01, 'max': 500}}},
'LTC/USDT': {'precision': {'amount': 4, 'price': 2}, 'limits': {'amount': {'min': 0.02, 'max': 450}}},
'MC/CNET': {'precision': {'amount': 2, 'price': 6}, 'limits': {'amount': {'min': 10000, 'max': 100000000}}},
'MCC/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 30, 'max': 350000}}},
'MOC/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 25, 'max': 600000}}},
'MRYC/CNET': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 300, 'max': 3000000}}},
'MT/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 200, 'max': 6000000}}},
'MXI/CNET': {'precision': {'amount': 2, 'price': 6}, 'limits': {'amount': {'min': 5000, 'max': 60000000}}},
'NAI/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 10, 'max': 100000}}},
'NAS/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 0.2, 'max': 15000}}},
'NAS/CKUSD': {'precision': {'amount': 2, 'price': 2}, 'limits': {'amount': {'min': 0.5, 'max': 5000}}},
'NEWOS/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 65, 'max': 700000}}},
'NKN/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 3, 'max': 350000}}},
'NTK/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 2, 'max': 30000}}},
'ONT/CKUSD': {'precision': {'amount': 2, 'price': 3}, 'limits': {'amount': {'min': 0.2, 'max': 2000}}},
'ONT/ETH': {'precision': {'amount': 3, 'price': 8}, 'limits': {'amount': {'min': 0.01, 'max': 1000}}},
'PNT/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 80, 'max': 800000}}},
'PST/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 5, 'max': 100000}}},
'PTT/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 450, 'max': 10000000}}},
'QTUM/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 0.4, 'max': 2800}}},
'QTUM/CKUSD': {'precision': {'amount': 2, 'price': 2}, 'limits': {'amount': {'min': 0.1, 'max': 1000}}},
'RATING/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 500, 'max': 10000000}}},
'RHC/CNET': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 1000, 'max': 10000000}}},
'SDA/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 20, 'max': 500000}}},
'SDD/CKUSD': {'precision': {'amount': 2, 'price': 3}, 'limits': {'amount': {'min': 10, 'max': 100000}}},
'SHC/CNET': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 250, 'max': 2500000}}},
'SHE/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 100, 'max': 5000000}}},
'SMC/CNET': {'precision': {'amount': 2, 'price': 6}, 'limits': {'amount': {'min': 1000, 'max': 10000000}}},
'SOP/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 50, 'max': 1000000}}},
'TAC/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 35, 'max': 800000}}},
'TIP/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 7, 'max': 200000}}},
'TKT/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 40, 'max': 400000}}},
'TLC/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 500, 'max': 10000000}}},
'TNC/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 10, 'max': 110000}}},
'TUB/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 200, 'max': 8000000}}},
'UC/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 100, 'max': 3000000}}},
'UDB/CNET': {'precision': {'amount': 2, 'price': 6}, 'limits': {'amount': {'min': 2000, 'max': 40000000}}},
'UIC/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 5, 'max': 150000}}},
'VAAC/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 10, 'max': 250000}}},
'VPN/CNET': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 200, 'max': 2000000}}},
'VSC/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 30, 'max': 650000}}},
'WAVES/CKUSD': {'precision': {'amount': 2, 'price': 3}, 'limits': {'amount': {'min': 0.15, 'max': 1500}}},
'WDNA/ETH': {'precision': {'amount': 2, 'price': 8}, 'limits': {'amount': {'min': 100, 'max': 250000}}},
'WIC/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 3, 'max': 30000}}},
'XAS/CNET': {'precision': {'amount': 2, 'price': 2}, 'limits': {'amount': {'min': 2.5, 'max': 25000}}},
'XLM/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 10, 'max': 300000}}},
'XLM/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 1, 'max': 300000}}},
'XLM/USDT': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 5, 'max': 150000}}},
'XRP/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 24, 'max': 100000}}},
'XRP/CKUSD': {'precision': {'amount': 2, 'price': 3}, 'limits': {'amount': {'min': 5, 'max': 50000}}},
'YBCT/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 15, 'max': 200000}}},
'YBCT/CKUSD': {'precision': {'amount': 2, 'price': 4}, 'limits': {'amount': {'min': 10, 'max': 200000}}},
'YBY/CNET': {'precision': {'amount': 2, 'price': 6}, 'limits': {'amount': {'min': 25000, 'max': 250000000}}},
'ZEC/BTC': {'precision': {'amount': 4, 'price': 8}, 'limits': {'amount': {'min': 0.02, 'max': 100}}},
'ZEC/CKUSD': {'precision': {'amount': 4, 'price': 2}, 'limits': {'amount': {'min': 0.02, 'max': 100}}},
},
},
})
async def fetch_trading_limits(self, symbols=None, params={}):
# self method should not be called directly, use loadTradingLimits() instead
# by default it will try load withdrawal fees of all currencies(with separate requests, sequentially)
# however if you define symbols = ['ETH/BTC', 'LTC/BTC'] in args it will only load those
await self.load_markets()
if symbols is None:
symbols = self.symbols
result = {}
for i in range(0, len(symbols)):
symbol = symbols[i]
result[symbol] = await self.fetch_trading_limits_by_id(self.market_id(symbol), params)
return result
async def fetch_trading_limits_by_id(self, id, params={}):
request = {
'symbol': id,
}
response = await self.publicPostApiOrderTicker(self.extend(request, params))
#
# { code: 0,
# msg: "获取牌价信息成功",
# data: { high: 0.03721392,
# low: 0.03335362,
# buy: "0.03525757",
# sell: "0.03531160",
# last: 0.0352634,
# vol: "184742.4176",
# min_trade: "0.01500000",
# max_trade: "100.00000000",
# number_float: "4",
# price_float: "8" }}}
#
return self.parse_trading_limits(self.safe_value(response, 'data', {}))
def parse_trading_limits(self, limits, symbol=None, params={}):
#
# { high: 0.03721392,
# low: 0.03335362,
# buy: "0.03525757",
# sell: "0.03531160",
# last: 0.0352634,
# vol: "184742.4176",
# min_trade: "0.01500000",
# max_trade: "100.00000000",
# number_float: "4",
# price_float: "8" }
#
return {
'info': limits,
'precision': {
'amount': self.safe_integer(limits, 'number_float'),
'price': self.safe_integer(limits, 'price_float'),
},
'limits': {
'amount': {
'min': self.safe_float(limits, 'min_trade'),
'max': self.safe_float(limits, 'max_trade'),
},
},
}
async def fetch_markets(self, params={}):
response = await self.publicGetApiMarketGetPriceList(params)
result = []
keys = list(response.keys())
for i in range(0, len(keys)):
currentMarketId = keys[i]
currentMarkets = response[currentMarketId]
for j in range(0, len(currentMarkets)):
market = currentMarkets[j]
baseId = self.safe_string(market, 'coin_from')
quoteId = self.safe_string(market, 'coin_to')
base = baseId.upper()
quote = quoteId.upper()
base = self.safe_currency_code(base)
quote = self.safe_currency_code(quote)
id = baseId + '2' + quoteId
symbol = base + '/' + quote
active = True
defaults = self.safe_value(self.options['limits'], symbol, {})
result.append(self.extend({
'id': id,
'symbol': symbol,
'base': base,
'quote': quote,
'baseId': baseId,
'quoteId': quoteId,
'active': active,
# overrided by defaults from self.options['limits']
'precision': {
'amount': None,
'price': None,
},
# overrided by defaults from self.options['limits']
'limits': {
'amount': {'min': None, 'max': None},
'price': {'min': None, 'max': None},
'cost': {'min': None, 'max': None},
},
'info': market,
}, defaults))
return result
def parse_trade(self, trade, market=None):
symbol = None
if market is not None:
symbol = market['symbol']
timestamp = self.safe_timestamp_2(trade, 'date', 'created')
id = self.safe_string(trade, 'tid')
orderId = self.safe_string(trade, 'order_id')
amount = self.safe_float_2(trade, 'number', 'amount')
price = self.safe_float(trade, 'price')
cost = None
if price is not None:
if amount is not None:
cost = amount * price
side = self.safe_string(trade, 'side')
if side == 'sale':
side = 'sell'
return {
'info': trade,
'id': id,
'timestamp': timestamp,
'datetime': self.iso8601(timestamp),
'symbol': symbol,
'type': None,
'side': side,
'price': price,
'amount': amount,
'cost': cost,
'order': orderId,
'fee': None,
'takerOrMaker': None,
}
async def fetch_trades(self, symbol, since=None, limit=None, params={}):
await self.load_markets()
request = {
'symbol': self.market_id(symbol),
}
if limit is not None:
request['limit'] = limit
market = self.market(symbol)
response = await self.publicPostApiOrderMarketOrder(self.extend(request, params))
return self.parse_trades(response['data'], market, since, limit)
async def fetch_balance(self, params={}):
await self.load_markets()
response = await self.privatePostApiUserUserBalance(params)
data = self.safe_value(response, 'data')
keys = list(data.keys())
result = {}
for i in range(0, len(keys)):
key = keys[i]
amount = self.safe_float(data, key)
parts = key.split('_')
currencyId = parts[0]
lockOrOver = parts[1]
code = self.safe_currency_code(currencyId)
if not (code in result):
result[code] = self.account()
if lockOrOver == 'lock':
result[code]['used'] = float(amount)
else:
result[code]['free'] = float(amount)
keys = list(result.keys())
for i in range(0, len(keys)):
key = keys[i]
total = self.sum(result[key]['used'], result[key]['free'])
result[key]['total'] = total
result['info'] = data
return self.parse_balance(result)
async def fetch_ticker(self, symbol, params={}):
await self.load_markets()
market = self.markets[symbol]
request = {
'part': market['quoteId'],
'coin': market['baseId'],
}
response = await self.publicPostApiMarketGetCoinTrade(self.extend(request, params))
timestamp = self.milliseconds()
return {
'symbol': symbol,
'timestamp': timestamp,
'datetime': self.iso8601(timestamp),
'high': self.safe_float(response, 'max'),
'low': self.safe_float(response, 'min'),
'bid': self.safe_float(response, 'buy'),
'bidVolume': None,
'ask': self.safe_float(response, 'sale'),
'askVolume': None,
'vwap': None,
'open': None,
'close': self.safe_float(response, 'price'),
'last': self.safe_float(response, 'price'),
'previousClose': None,
'change': None,
'percentage': self.safe_float(response, 'change_24h'),
'average': None,
'baseVolume': self.safe_float(response, 'volume_24h'),
'quoteVolume': None,
'info': response,
}
async def fetch_order_book(self, symbol, limit=None, params={}):
await self.load_markets()
marketId = self.market_id(symbol)
request = {
'symbol': marketId,
}
response = await self.publicPostApiOrderDepth(self.extend(request, params))
data = self.safe_value(response, 'data')
timestamp = self.safe_timestamp(data, 'date')
return self.parse_order_book(data, timestamp)
async def fetch_my_trades(self, symbol=None, since=None, limit=None, params={}):
await self.load_markets()
market = self.market(symbol)
request = {
'symbol': market['id'],
}
response = await self.privatePostApiOrderOrderList(self.extend(request, params))
return self.parse_trades(response['data'], market, since, limit)
def parse_order_status(self, status):
statuses = {
'0': 'open',
'1': 'open', # partially filled
'2': 'closed',
'3': 'canceled',
}
return self.safe_string(statuses, status, status)
async def fetch_order(self, id, symbol=None, params={}):
if symbol is None:
raise ArgumentsRequired(self.id + ' fetchOrder requires a `symbol` argument')
await self.load_markets()
request = {
'symbol': self.market_id(symbol),
'trust_id': id,
}
response = await self.privatePostApiOrderOrderInfo(self.extend(request, params))
order = self.safe_value(response, 'data')
timestamp = self.safe_timestamp(order, 'created')
status = self.parse_order_status(self.safe_string(order, 'status'))
side = self.safe_string(order, 'flag')
if side == 'sale':
side = 'sell'
# Can't use parseOrder because the data format is different btw endpoint for fetchOrder and fetchOrders
return {
'info': order,
'id': id,
'timestamp': timestamp,
'datetime': self.iso8601(timestamp),
'lastTradeTimestamp': None,
'symbol': symbol,
'type': None,
'side': side,
'price': self.safe_float(order, 'price'),
'cost': None,
'average': self.safe_float(order, 'avg_price'),
'amount': self.safe_float(order, 'number'),
'filled': self.safe_float(order, 'numberdeal'),
'remaining': self.safe_float(order, 'numberover'),
'status': status,
'fee': None,
'clientOrderId': None,
'trades': None,
}
def parse_order(self, order, market=None):
id = self.safe_string(order, 'id')
timestamp = self.safe_timestamp(order, 'datetime')
symbol = None
if market is not None:
symbol = market['symbol']
type = None
side = self.safe_string(order, 'type')
if side == 'sale':
side = 'sell'
price = self.safe_float(order, 'price')
average = self.safe_float(order, 'avg_price')
amount = self.safe_float(order, 'amount')
remaining = self.safe_float(order, 'amount_outstanding')
filled = amount - remaining
status = self.parse_order_status(self.safe_string(order, 'status'))
cost = filled * price
fee = None
result = {
'info': order,
'id': id,
'clientOrderId': None,
'timestamp': timestamp,
'datetime': self.iso8601(timestamp),
'lastTradeTimestamp': None,
'symbol': symbol,
'type': type,
'timeInForce': None,
'postOnly': None,
'side': side,
'price': price,
'stopPrice': None,
'cost': cost,
'average': average,
'amount': amount,
'filled': filled,
'remaining': remaining,
'status': status,
'fee': fee,
'trades': None,
}
return result
async def fetch_orders_by_type(self, type, symbol=None, since=None, limit=None, params={}):
await self.load_markets()
request = {
'type': type,
}
market = None
if symbol is not None:
market = self.market(symbol)
request['symbol'] = market['id']
response = await self.privatePostApiOrderTradeList(self.extend(request, params))
if 'data' in response:
return self.parse_orders(response['data'], market, since, limit)
return []
async def fetch_open_orders(self, symbol=None, since=None, limit=None, params={}):
return self.fetch_orders_by_type('open', symbol, since, limit, params)
async def fetch_closed_orders(self, symbol=None, since=None, limit=None, params={}):
orders = await self.fetch_orders(symbol, since, limit, params)
return self.filter_by(orders, 'status', 'closed')
async def fetch_orders(self, symbol=None, since=None, limit=None, params={}):
return self.fetch_orders_by_type('all', symbol, since, limit, params)
async def create_order(self, symbol, type, side, amount, price=None, params={}):
await self.load_markets()
request = {
'symbol': self.market_id(symbol),
'type': side,
'price': self.price_to_precision(symbol, price),
'number': self.amount_to_precision(symbol, amount),
}
response = await self.privatePostApiOrderCoinTrust(self.extend(request, params))
data = self.safe_value(response, 'data', {})
id = self.safe_string(data, 'order_id')
return {
'info': response,
'id': id,
}
async def cancel_order(self, id, symbol=None, params={}):
if symbol is None:
raise ArgumentsRequired(self.id + ' cancelOrder requires a `symbol` argument')
await self.load_markets()
request = {}
if symbol is not None:
request['symbol'] = self.market_id(symbol)
if id is not None:
request['order_id'] = id
return await self.privatePostApiOrderCancel(self.extend(request, params))
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
url = self.urls['api'] + '/' + self.implode_params(path, params)
query = self.omit(params, self.extract_params(path))
if api == 'public':
if query:
url += '?' + self.urlencode(query)
else:
self.check_required_credentials()
payload = self.urlencode({'api_key': self.apiKey})
if query:
payload += '&' + self.urlencode(self.keysort(query))
auth = payload + '&secret_key=' + self.secret
signature = self.hash(self.encode(auth))
body = payload + '&sign=' + signature
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
}
return {'url': url, 'method': method, 'body': body, 'headers': headers}
def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
if response is None:
return # fallback to default error handler
errorCode = self.safe_value(response, 'code')
if errorCode is not None:
if errorCode != 0:
#
# {code: 1, msg: "该币不存在,非法操作"} - returned when a required symbol parameter is missing in the request(also, maybe on other types of errors as well)
# {code: 1, msg: '公钥不合法'} - wrong public key
# {code: 1, msg: '价格输入有误,请检查你的数值精度'} - 'The price input is incorrect, please check your numerical accuracy'
# {code: 1, msg: '单笔最小交易数量不能小于0.00100000,请您重新挂单'} -
# 'The minimum number of single transactions cannot be less than 0.00100000. Please re-post the order'
#
message = self.safe_string(response, 'msg')
feedback = self.id + ' ' + message
self.throw_exactly_matched_exception(self.exceptions, message, feedback)
if message.find('请您重新挂单') >= 0: # minimum limit
raise InvalidOrder(feedback)
else:
raise ExchangeError(feedback)
| -1 |
ccxt/ccxt | 8,318 | SBTC mapping | https://coinmarketcap.com/currencies/sbtc/markets/
https://coinmarketcap.com/currencies/super-bitcoin/
https://www.coingecko.com/en/coins/siambitcoin | ndubel | "2021-01-21T10:35:23" | "2021-01-21T20:04:45" | 2614db0ebd43f3cf9e1222bde6cefbabb955f681 | 05f5feeaaac3d213bc1314ba47b814db9ac30852 | SBTC mapping. https://coinmarketcap.com/currencies/sbtc/markets/
https://coinmarketcap.com/currencies/super-bitcoin/
https://www.coingecko.com/en/coins/siambitcoin | ./examples/py/async-okex-fetch-margin-balance-with-options.py | # -*- coding: utf-8 -*-
import asyncio
import os
import sys
from pprint import pprint
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')
import ccxt.async_support as ccxt # noqa: E402
async def loop(exchange):
while True:
try:
balance = await exchange.fetch_balance()
pprint(balance)
except Exception as e:
print('fetch_balance() failed')
print(e)
async def main():
exchange = ccxt.okex({
'enableRateLimit': True,
'apiKey': 'YOUR_API_KEY',
'secret': 'YOUR_SECRET',
# okex requires this: https://github.com/ccxt/ccxt/wiki/Manual#authentication
'password': 'YOUR_API_PASSWORD',
# to always default to 'margin' balance type
'options': {
'fetchBalance': 'margin',
},
})
await loop(exchange)
await exchange.close()
if __name__ == '__main__':
asyncio.get_event_loop().run_until_complete(main())
| # -*- coding: utf-8 -*-
import asyncio
import os
import sys
from pprint import pprint
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')
import ccxt.async_support as ccxt # noqa: E402
async def loop(exchange):
while True:
try:
balance = await exchange.fetch_balance()
pprint(balance)
except Exception as e:
print('fetch_balance() failed')
print(e)
async def main():
exchange = ccxt.okex({
'enableRateLimit': True,
'apiKey': 'YOUR_API_KEY',
'secret': 'YOUR_SECRET',
# okex requires this: https://github.com/ccxt/ccxt/wiki/Manual#authentication
'password': 'YOUR_API_PASSWORD',
# to always default to 'margin' balance type
'options': {
'fetchBalance': 'margin',
},
})
await loop(exchange)
await exchange.close()
if __name__ == '__main__':
asyncio.get_event_loop().run_until_complete(main())
| -1 |
ccxt/ccxt | 8,318 | SBTC mapping | "https://coinmarketcap.com/currencies/sbtc/markets/\r\nhttps://coinmarketcap.com/currencies/super-bi(...TRUNCATED) | ndubel | "2021-01-21T10:35:23" | "2021-01-21T20:04:45" | 2614db0ebd43f3cf9e1222bde6cefbabb955f681 | 05f5feeaaac3d213bc1314ba47b814db9ac30852 | "SBTC mapping. https://coinmarketcap.com/currencies/sbtc/markets/\r\nhttps://coinmarketcap.com/curre(...TRUNCATED) | ./python/ccxt/yobit.py | "# -*- coding: utf-8 -*-\n\n# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:(...TRUNCATED) | "# -*- coding: utf-8 -*-\n\n# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:(...TRUNCATED) | -1 |
huggingface/transformers | 20,340 | [FLAX] Add dtype to embedding for bert/bart/opt/t5 | "## What does this PR do?\r\n\r\nThis PR is the follow-up of #18462. It adds dtype to `nn.Embed` for(...TRUNCATED) | merrymercy | "2022-11-21T00:53:45" | "2022-11-28T15:21:43" | 667ccea72235504ab7876024e4f8c113ca62190f | ac2f6674a33e8eaffdf868e1fa6cbc8e722f469e | "[FLAX] Add dtype to embedding for bert/bart/opt/t5. ## What does this PR do?\r\n\r\nThis PR is the (...TRUNCATED) | ./tests/models/bert/__init__.py | -1 |
End of preview. Expand
in Dataset Viewer.
README.md exists but content is empty.
Use the Edit dataset card button to edit it.
- Downloads last month
- 200