Skip to content

Commit

Permalink
ccxt#44 added bl3p api
Browse files Browse the repository at this point in the history
  • Loading branch information
kroitor committed Jul 23, 2017
1 parent 05c3cdf commit 137b792
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 22 deletions.
39 changes: 38 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,44 @@ Below are key notes on how to keep the JS code transpileable:
- do not use conditional statements that are too complex
- ...

If you want to add (support for) another market or implement a new method for a particular exchange, then the best way to make it a consistent improvement is to learn by example, take a look at how same things are implemented in other markets and try to copy the code flow and style.
**If you want to add (support for) another market or implement a new method for a particular exchange, then the best way to make it a consistent improvement is to learn by example, take a look at how same things are implemented in other markets and try to copy the code flow and style.**

The basic JSON-skeleton for a new market integration is as follows:

```JSON
{
"id": "example",
"name": "Example Exchange",
"country": [ "US", "EU", "CN", "RU" ],
"rateLimit": 1000,
"version": "1",
"comment": "This comment is optional",
"urls": {
"logo": "https://example.com/image.jpg",
"api": "https://api.example.com/api",
"www": "https://www.example.com",
"doc": [
"https://www.example.com/docs/api",
"https://www.example.com/docs/howto",
"https://github.com/example/docs",
],
},
"api": {
"public": {
"get": [
"endpoint/example",
"orderbook/{pair}/full",
"{pair}/ticker",
]
},
"private": {
"post": [
"balance",
],
}
}
}
```

```UNDER CONSTRUCTION```

Expand Down
42 changes: 25 additions & 17 deletions ccxt.js
Original file line number Diff line number Diff line change
Expand Up @@ -3646,15 +3646,13 @@ var bl3p = {
},
'private': {
'post': [

'{market}/money/depth/full',
'{market}/money/order/add',
'{market}/money/order/cancel',
'{market}/money/order/result',
'{market}/money/orders',
'{market}/money/orders/history',
'{market}/money/trades/fetch',

'GENMKT/money/info',
'GENMKT/money/deposit_address',
'GENMKT/money/new_deposit_address',
Expand All @@ -3664,26 +3662,36 @@ var bl3p = {
},
},
'products': {
// GENMKT is not a product, they mean general market info )
'BTC/EUR': { 'id': 'BTCEUR', 'symbol': 'BTC/EUR', 'base': 'BTC', 'quote': 'EUR' },
'LTC/EUR': { 'id': 'LTCEUR', 'symbol': 'LTC/EUR', 'base': 'LTC', 'quote': 'EUR' },
},

fetchBalance () {
/*
Response
user_id int Id of the user.
trade_fee float Percentage fee for the user
wallets array Array of wallets.
Each array item of 'wallets' will contain:
balance amountObj Balance in this wallet
available amountObj Available in this wallet.
async fetchBalance () {
let response = await this.privatePostGENMKTMoneyInfo ();
let balance = response['wallets'];

*/
return this.privatePostGENMKTMoneyInfo ();
let result = { 'info': balance };
for (let c = 0; c < this.currencies.length; c++) {
let currency = this.currencies[c];
let account = {
'free': undefined,
'used': undefined,
'total': undefined,
};
if (currency in balance) {
if ('available' in balance[currency]) {
account['free'] = parseFloat (balance[currency]['available']);
}
}
if (currency in balance) {
if ('balance' in balance[currency]) {
account['total'] = parseFloat (balance[currency]['balance']);
}
}
account['used'] = account['total'] - account['free'];
result[currency] = account;
}
return result;
},

async fetchOrderBook (product) {
Expand Down
2 changes: 0 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
with open (path.join (here, 'package.json'), encoding = 'utf-8') as f:
package = json.load (f)

keywords = [('"' + item + '"') for item in package['keywords'] if (' ' not in item)]

setup (

name = package['name'],
Expand Down
2 changes: 0 additions & 2 deletions transpile.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ while (markets = regex.exec (contents)) {
[ /([^\s]+)\.toString \(\)/g, 'str ($1)' ],
[ /([^\s]+)\.join\s*\(\s*([^\)\[\]]+?)\s*\)/g, '$2.join ($1)' ],
[ /Math\.(max|min)/g, '$1' ],
// typeof xxx['yyy'] == 'undefined'
]

let phRegex = [
Expand All @@ -167,7 +166,6 @@ while (markets = regex.exec (contents)) {
[ /this\./g, '$this->' ],
[ / this;/g, ' $this;' ],
[ /this_\./g, '$this_->' ],
// [ /([^a-zA-Z\$])this([^a-zA-Z])/g, '$1$this$2' ],
[ /\{\}/g, 'array ()' ],
[ /\[\]/g, 'array ()' ],
[ /\{([^\n\}]+)\}/g, 'array ($1)' ],
Expand Down

0 comments on commit 137b792

Please sign in to comment.