Skip to content

Commit

Permalink
1.14.116
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
Travis CI committed Jun 1, 2018
1 parent 6c1ba46 commit 7b957f6
Show file tree
Hide file tree
Showing 12 changed files with 284 additions and 114 deletions.
117 changes: 96 additions & 21 deletions build/ccxt.browser.js

Large diffs are not rendered by default.

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

const version = '1.14.115'
const version = '1.14.116'

Exchange.ccxtVersion = version

Expand Down
2 changes: 1 addition & 1 deletion doc/README.rst
Expand Up @@ -573,7 +573,7 @@ Thank you!
:target: https://nodesecurity.io/orgs/ccxt/projects/856d3088-8b46-4515-9324-6b7cd2470522
.. |Gitter| image:: https://badges.gitter.im/ccxt-dev/ccxt.svg
:target: https://gitter.im/ccxt-dev/ccxt?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge
.. |Supported Exchanges| image:: https://img.shields.io/badge/exchanges-115-blue.svg
.. |Supported Exchanges| image:: https://img.shields.io/badge/exchanges-116-blue.svg
:target: https://github.com/ccxt/ccxt/wiki/Exchange-Markets
.. |Open Collective| image:: https://opencollective.com/ccxt/backers/badge.svg
:target: https://opencollective.com/ccxt
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "ccxt",
"version": "1.14.115",
"version": "1.14.116",
"description": "A JavaScript / Python / PHP cryptocurrency trading library with support for 100+ exchanges",
"main": "./ccxt.js",
"unpkg": "build/ccxt.browser.js",
Expand Down
2 changes: 1 addition & 1 deletion php/Exchange.php
Expand Up @@ -30,7 +30,7 @@

namespace ccxt;

$version = '1.14.115';
$version = '1.14.116';

// rounding mode
const TRUNCATE = 0;
Expand Down
101 changes: 82 additions & 19 deletions php/bit2c.php
Expand Up @@ -18,6 +18,7 @@ public function describe () {
'has' => array (
'CORS' => false,
'fetchOpenOrders' => true,
'fetchMyTrades' => true,
),
'urls' => array (
'logo' => 'https://user-images.githubusercontent.com/1294454/27766119-3593220e-5ece-11e7-8b3a-5a041f6bcc3f.jpg',
Expand Down Expand Up @@ -135,25 +136,6 @@ public function fetch_ticker ($symbol, $params = array ()) {
);
}

public function parse_trade ($trade, $market = null) {
$timestamp = intval ($trade['date']) * 1000;
$symbol = null;
if ($market)
$symbol = $market['symbol'];
return array (
'id' => (string) $trade['tid'],
'info' => $trade,
'timestamp' => $timestamp,
'datetime' => $this->iso8601 ($timestamp),
'symbol' => $symbol,
'order' => null,
'type' => null,
'side' => null,
'price' => $trade['price'],
'amount' => $trade['amount'],
);
}

public function fetch_trades ($symbol, $since = null, $limit = null, $params = array ()) {
$market = $this->market ($symbol);
$response = $this->publicGetExchangesPairTrades (array_merge (array (
Expand Down Expand Up @@ -253,4 +235,85 @@ public function parse_order ($order, $market = null) {
'info' => $order,
);
}

public function fetch_my_trades ($symbol = null, $since = null, $limit = null, $params = array ()) {
$this->load_markets();
$market = null;
$method = 'privateGetOrderOrderhistory';
$request = array ();
if ($limit !== null)
$request['take'] = $limit;
$request['take'] = $limit;
if ($since !== null) {
$request['toTime'] = $this->ymd ($this->milliseconds (), '.');
$request['fromTime'] = $this->ymd ($since, '.');
}
if ($symbol !== null) {
$market = $this->market ($symbol);
$request['pair'] = $market['id'];
}
$response = $this->$method (array_merge ($request, $params));
return $this->parse_trades($response, $market, $since, $limit);
}

public function parse_trade ($trade, $market = null) {
$timestamp = null;
$id = null;
$price = null;
$amount = null;
$orderId = null;
$feeCost = null;
$side = null;
$reference = $this->safe_string($trade, 'reference');
if ($reference !== null) {
$timestamp = $this->safe_integer($trade, 'ticks') * 1000;
$price = $this->safe_float($trade, 'price');
$amount = $this->safe_float($trade, 'firstAmount');
$reference_parts = explode ('|', $reference); // $reference contains => 'pair|$orderId|tradeId'
if ($market === null) {
$marketId = $this->safe_string($trade, 'pair');
if (is_array ($this->markets_by_id[$marketId]) && array_key_exists ($marketId, $this->markets_by_id[$marketId])) {
$market = $this->markets_by_id[$marketId];
} else if (is_array ($this->markets_by_id) && array_key_exists ($reference_parts[0], $this->markets_by_id)) {
$market = $this->markets_by_id[$reference_parts[0]];
}
}
$orderId = $reference_parts[1];
$id = $reference_parts[2];
$side = $this->safe_integer($trade, 'action');
if ($side === 0) {
$side = 'buy';
} else if ($side === 1) {
$side = 'sell';
}
$feeCost = $this->safe_float($trade, 'feeAmount');
} else {
$timestamp = $this->safe_integer($trade, 'date') * 1000;
$id = $this->safe_integer($trade, 'tid');
$price = $this->safe_float($trade, 'price');
$amount = $this->safe_float($trade, 'amount');
}
$symbol = null;
if ($market !== null)
$symbol = $market['symbol'];
return array (
'info' => $trade,
'id' => $id,
'timestamp' => $timestamp,
'datetime' => $this->iso8601 ($timestamp),
'symbol' => $symbol,
'order' => $orderId,
'type' => null,
'side' => $side,
'takerOrMaker' => null,
'price' => $price,
'amount' => $amount,
'cost' => $price * $amount,
'fee' => array (
'cost' => $feeCost,
'currency' => 'NIS',
'rate' => null,
),
);
}
}
2 changes: 1 addition & 1 deletion python/ccxt/__init__.py
Expand Up @@ -22,7 +22,7 @@

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

__version__ = '1.14.115'
__version__ = '1.14.116'

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

Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/async/__init__.py
Expand Up @@ -4,7 +4,7 @@

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

__version__ = '1.14.115'
__version__ = '1.14.116'

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

Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/async/base/exchange.py
Expand Up @@ -2,7 +2,7 @@

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

__version__ = '1.14.115'
__version__ = '1.14.116'

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

Expand Down
92 changes: 74 additions & 18 deletions python/ccxt/async/bit2c.py
Expand Up @@ -19,6 +19,7 @@ def describe(self):
'has': {
'CORS': False,
'fetchOpenOrders': True,
'fetchMyTrades': True,
},
'urls': {
'logo': 'https://user-images.githubusercontent.com/1294454/27766119-3593220e-5ece-11e7-8b3a-5a041f6bcc3f.jpg',
Expand Down Expand Up @@ -130,24 +131,6 @@ async def fetch_ticker(self, symbol, params={}):
'info': ticker,
}

def parse_trade(self, trade, market=None):
timestamp = int(trade['date']) * 1000
symbol = None
if market:
symbol = market['symbol']
return {
'id': str(trade['tid']),
'info': trade,
'timestamp': timestamp,
'datetime': self.iso8601(timestamp),
'symbol': symbol,
'order': None,
'type': None,
'side': None,
'price': trade['price'],
'amount': trade['amount'],
}

async def fetch_trades(self, symbol, since=None, limit=None, params={}):
market = self.market(symbol)
response = await self.publicGetExchangesPairTrades(self.extend({
Expand Down Expand Up @@ -238,3 +221,76 @@ def parse_order(self, order, market=None):
'fee': None,
'info': order,
}

async def fetch_my_trades(self, symbol=None, since=None, limit=None, params={}):
await self.load_markets()
market = None
method = 'privateGetOrderOrderhistory'
request = {}
if limit is not None:
request['take'] = limit
request['take'] = limit
if since is not None:
request['toTime'] = self.ymd(self.milliseconds(), '.')
request['fromTime'] = self.ymd(since, '.')
if symbol is not None:
market = self.market(symbol)
request['pair'] = market['id']
response = await getattr(self, method)(self.extend(request, params))
return self.parse_trades(response, market, since, limit)

def parse_trade(self, trade, market=None):
timestamp = None
id = None
price = None
amount = None
orderId = None
feeCost = None
side = None
reference = self.safe_string(trade, 'reference')
if reference is not None:
timestamp = self.safe_integer(trade, 'ticks') * 1000
price = self.safe_float(trade, 'price')
amount = self.safe_float(trade, 'firstAmount')
reference_parts = reference.split('|') # reference contains: 'pair|orderId|tradeId'
if market is None:
marketId = self.safe_string(trade, 'pair')
if marketId in self.markets_by_id[marketId]:
market = self.markets_by_id[marketId]
elif reference_parts[0] in self.markets_by_id:
market = self.markets_by_id[reference_parts[0]]
orderId = reference_parts[1]
id = reference_parts[2]
side = self.safe_integer(trade, 'action')
if side == 0:
side = 'buy'
elif side == 1:
side = 'sell'
feeCost = self.safe_float(trade, 'feeAmount')
else:
timestamp = self.safe_integer(trade, 'date') * 1000
id = self.safe_integer(trade, 'tid')
price = self.safe_float(trade, 'price')
amount = self.safe_float(trade, 'amount')
symbol = None
if market is not None:
symbol = market['symbol']
return {
'info': trade,
'id': id,
'timestamp': timestamp,
'datetime': self.iso8601(timestamp),
'symbol': symbol,
'order': orderId,
'type': None,
'side': side,
'takerOrMaker': None,
'price': price,
'amount': amount,
'cost': price * amount,
'fee': {
'cost': feeCost,
'currency': 'NIS',
'rate': None,
},
}
2 changes: 1 addition & 1 deletion python/ccxt/base/exchange.py
Expand Up @@ -4,7 +4,7 @@

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

__version__ = '1.14.115'
__version__ = '1.14.116'

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

Expand Down

0 comments on commit 7b957f6

Please sign in to comment.