Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ccxt-dev/ccxt
Browse files Browse the repository at this point in the history
  • Loading branch information
kroitor committed Dec 6, 2017
2 parents 6842ded + 070419d commit 6c8fcd9
Show file tree
Hide file tree
Showing 12 changed files with 264 additions and 26 deletions.
99 changes: 81 additions & 18 deletions build/ccxt.browser.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ccxt.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const errors = require ('./js/base/errors')
//-----------------------------------------------------------------------------
// this is updated by vss.js when building

const version = '1.10.297'
const version = '1.10.298'

Exchange.ccxtVersion = version

Expand Down
2 changes: 1 addition & 1 deletion ccxt.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

namespace ccxt;

$version = '1.10.297';
$version = '1.10.298';

const CLASSES_DIR = __DIR__ . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR;

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ccxt",
"version": "1.10.297",
"version": "1.10.298",
"description": "A JavaScript / Python / PHP cryptocurrency trading library with support for 90+ exchanges",
"main": "./ccxt.js",
"unpkg": "build/ccxt.browser.js",
Expand Down
2 changes: 1 addition & 1 deletion php/binance.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public function fetch_markets () {
if (array_key_exists ('LOT_SIZE', $filters)) {
$filter = $filters['LOT_SIZE'];
$entry['precision']['amount'] = $this->precision_from_string($filter['stepSize']);
$entry['lot'] = floatval ($filter['stepSize'])
$entry['lot'] = floatval ($filter['stepSize']);
$entry['limits']['amount'] = array (
'min' => floatval ($filter['minQty']),
'max' => floatval ($filter['maxQty']),
Expand Down
59 changes: 59 additions & 0 deletions php/hitbtc2.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ public function describe () {
'hasFetchClosedOrders' => true,
'hasFetchMyTrades' => true,
'hasWithdraw' => true,
'hasFetchCurrencies' => true,
// new metainfo interface
'has' => array (
'fetchCurrencies' => true,
'fetchOHLCV' => true,
'fetchTickers' => true,
'fetchOrder' => true,
Expand Down Expand Up @@ -175,6 +177,63 @@ public function fetch_markets () {
return $result;
}

public function fetch_currencies ($params = array ()) {
$this->verbose = true;
$currencies = $this->publicGetCurrency ($params);
$result = array ();
for ($i = 0; $i < count ($currencies); $i++) {
$currency = $currencies[$i];
$id = $currency['id'];
// todo => will need to rethink the fees
// to add support for multiple withdrawal/deposit methods and
// differentiated fees for each particular method
$precision = array (
'amount' => 8, // default $precision, todo => fix "magic constants"
'price' => 8,
);
$code = $this->common_currency_code($id);
$payin = $currency['payinEnabled'];
$payout = $currency['payoutEnabled'];
$transfer = $currency['transferEnabled'];
$active = $payin && $payout && $transfer;
$status = ($currency['disabled']) ? 'disabled' : 'ok';
$type = ($currency['crypto']) ? 'crypto' : 'fiat';
$result[$code] = array (
'id' => $id,
'code' => $code,
'type' => $type,
'payin' => $payin,
'payout' => $payout,
'transfer' => $transfer,
'info' => $currency,
'name' => $currency['fullName'],
'active' => $active,
'status' => $status,
'fee' => null, // todo => redesign
'precision' => $precision,
'limits' => array (
'amount' => array (
'min' => pow (10, -$precision['amount']),
'max' => pow (10, $precision['amount']),
),
'price' => array (
'min' => pow (10, -$precision['price']),
'max' => pow (10, $precision['price']),
),
'cost' => array (
'min' => null,
'max' => null,
),
'withdraw' => array (
'min' => null,
'max' => pow (10, $precision['amount']),
),
),
);
}
return $result;
}

public function fetch_balance ($params = array ()) {
$this->load_markets();
$type = $this->safe_string($params, 'type', 'trading');
Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

# ----------------------------------------------------------------------------

__version__ = '1.10.297'
__version__ = '1.10.298'

# ----------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/async/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# -----------------------------------------------------------------------------

__version__ = '1.10.297'
__version__ = '1.10.298'

# -----------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/async/base/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# -----------------------------------------------------------------------------

__version__ = '1.10.297'
__version__ = '1.10.298'

# -----------------------------------------------------------------------------

Expand Down
58 changes: 58 additions & 0 deletions python/ccxt/async/hitbtc2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from ccxt.async.hitbtc import hitbtc
import base64
import math
import json
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import InsufficientFunds
Expand All @@ -27,8 +28,10 @@ def describe(self):
'hasFetchClosedOrders': True,
'hasFetchMyTrades': True,
'hasWithdraw': True,
'hasFetchCurrencies': True,
# new metainfo interface
'has': {
'fetchCurrencies': True,
'fetchOHLCV': True,
'fetchTickers': True,
'fetchOrder': True,
Expand Down Expand Up @@ -173,6 +176,61 @@ async def fetch_markets(self):
}))
return result

async def fetch_currencies(self, params={}):
self.verbose = True
currencies = await self.publicGetCurrency(params)
result = {}
for i in range(0, len(currencies)):
currency = currencies[i]
id = currency['id']
# todo: will need to rethink the fees
# to add support for multiple withdrawal/deposit methods and
# differentiated fees for each particular method
precision = {
'amount': 8, # default precision, todo: fix "magic constants"
'price': 8,
}
code = self.common_currency_code(id)
payin = currency['payinEnabled']
payout = currency['payoutEnabled']
transfer = currency['transferEnabled']
active = payin and payout and transfer
status = 'disabled' if (currency['disabled']) else 'ok'
type = 'crypto' if (currency['crypto']) else 'fiat'
result[code] = {
'id': id,
'code': code,
'type': type,
'payin': payin,
'payout': payout,
'transfer': transfer,
'info': currency,
'name': currency['fullName'],
'active': active,
'status': status,
'fee': None, # todo: redesign
'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': None,
'max': None,
},
'withdraw': {
'min': None,
'max': math.pow(10, precision['amount']),
},
},
}
return result

async def fetch_balance(self, params={}):
await self.load_markets()
type = self.safe_string(params, 'type', 'trading')
Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/base/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# -----------------------------------------------------------------------------

__version__ = '1.10.297'
__version__ = '1.10.298'

# -----------------------------------------------------------------------------

Expand Down
58 changes: 58 additions & 0 deletions python/ccxt/hitbtc2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from ccxt.hitbtc import hitbtc
import base64
import math
import json
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import InsufficientFunds
Expand All @@ -27,8 +28,10 @@ def describe(self):
'hasFetchClosedOrders': True,
'hasFetchMyTrades': True,
'hasWithdraw': True,
'hasFetchCurrencies': True,
# new metainfo interface
'has': {
'fetchCurrencies': True,
'fetchOHLCV': True,
'fetchTickers': True,
'fetchOrder': True,
Expand Down Expand Up @@ -173,6 +176,61 @@ def fetch_markets(self):
}))
return result

def fetch_currencies(self, params={}):
self.verbose = True
currencies = self.publicGetCurrency(params)
result = {}
for i in range(0, len(currencies)):
currency = currencies[i]
id = currency['id']
# todo: will need to rethink the fees
# to add support for multiple withdrawal/deposit methods and
# differentiated fees for each particular method
precision = {
'amount': 8, # default precision, todo: fix "magic constants"
'price': 8,
}
code = self.common_currency_code(id)
payin = currency['payinEnabled']
payout = currency['payoutEnabled']
transfer = currency['transferEnabled']
active = payin and payout and transfer
status = 'disabled' if (currency['disabled']) else 'ok'
type = 'crypto' if (currency['crypto']) else 'fiat'
result[code] = {
'id': id,
'code': code,
'type': type,
'payin': payin,
'payout': payout,
'transfer': transfer,
'info': currency,
'name': currency['fullName'],
'active': active,
'status': status,
'fee': None, # todo: redesign
'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': None,
'max': None,
},
'withdraw': {
'min': None,
'max': math.pow(10, precision['amount']),
},
},
}
return result

def fetch_balance(self, params={}):
self.load_markets()
type = self.safe_string(params, 'type', 'trading')
Expand Down

0 comments on commit 6c8fcd9

Please sign in to comment.