Skip to content

Commit

Permalink
1.10.1115
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
Travis CI committed Feb 15, 2018
1 parent 8ce5551 commit 3ca1cc8
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 23 deletions.
37 changes: 31 additions & 6 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 Exchange = require ('./js/base/Exchange')
//-----------------------------------------------------------------------------
// this is updated by vss.js when building

const version = '1.10.1114'
const version = '1.10.1115'

Exchange.ccxtVersion = version

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.1114",
"version": "1.10.1115",
"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/Exchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

namespace ccxt;

$version = '1.10.1114';
$version = '1.10.1115';

abstract class Exchange {

Expand Down
33 changes: 29 additions & 4 deletions php/bitstamp.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@ public function parse_trade ($trade, $market = null) {
$feeCurrency = $market['quote'];
$symbol = $market['symbol'];
}
$cost = null;
if ($price !== null)
if ($amount !== null)
$cost = $price * $amount;
return array (
'id' => $id,
'info' => $trade,
Expand All @@ -312,6 +316,7 @@ public function parse_trade ($trade, $market = null) {
'side' => $side,
'price' => $price,
'amount' => $amount,
'cost' => $cost,
'fee' => array (
'cost' => $feeCost,
'currency' => $feeCurrency,
Expand Down Expand Up @@ -431,14 +436,22 @@ public function parse_order ($order, $market = null) {
}
}
$amount = $this->safe_float($order, 'amount');
$filled = 0;
$filled = 0.0;
$trades = array ();
$transactions = $this->safe_value($order, 'transactions');
$feeCost = null;
$cost = null;
if ($transactions !== null) {
if (gettype ($transactions) === 'array' && count (array_filter (array_keys ($transactions), 'is_string')) == 0) {
for ($i = 0; $i < count ($transactions); $i++) {
$trade = $this->parse_trade(array_merge (array ( 'order_id' => $id ), $transactions[$i]), $market);
$filled .= $trade['amount'];
if ($feeCost === null)
$feeCost = 0.0;
$feeCost .= $trade['fee']['cost'];
if ($cost === null)
$cost = 0.0;
$cost .= $trade['cost'];
$trades[] = $trade;
}
}
Expand All @@ -458,12 +471,24 @@ public function parse_order ($order, $market = null) {
$side = $this->safe_string($order, 'type');
if ($side !== null)
$side = ($side === '1') ? 'sell' : 'buy';
$fee = null;
$cost = null;
if ($market === null)
$market = $this->get_market_from_trades ($trades);
if ($market !== null)
$feeCurrency = null;
if ($market !== null) {
$symbol = $market['symbol'];
$feeCurrency = $market['quote'];
}
if ($cost === null) {
if ($price !== null)
$cost = $price * $filled;
} else if ($price === null) {
if ($filled > 0)
$price = $cost / $filled;
}
$fee = array (
'cost' => $feeCost,
'currency' => $feeCurrency,
);
return array (
'id' => $id,
'datetime' => $iso8601,
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.1114'
__version__ = '1.10.1115'

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

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.1114'
__version__ = '1.10.1115'

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

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.1114'
__version__ = '1.10.1115'

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

Expand Down
29 changes: 26 additions & 3 deletions python/ccxt/async/bitstamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@ def parse_trade(self, trade, market=None):
amount = self.safe_float(trade, market['baseId'], amount)
feeCurrency = market['quote']
symbol = market['symbol']
cost = None
if price is not None:
if amount is not None:
cost = price * amount
return {
'id': id,
'info': trade,
Expand All @@ -312,6 +316,7 @@ def parse_trade(self, trade, market=None):
'side': side,
'price': price,
'amount': amount,
'cost': cost,
'fee': {
'cost': feeCost,
'currency': feeCurrency,
Expand Down Expand Up @@ -417,14 +422,22 @@ def parse_order(self, order, market=None):
if marketId in self.markets_by_id:
market = self.markets_by_id[marketId]
amount = self.safe_float(order, 'amount')
filled = 0
filled = 0.0
trades = []
transactions = self.safe_value(order, 'transactions')
feeCost = None
cost = None
if transactions is not None:
if isinstance(transactions, list):
for i in range(0, len(transactions)):
trade = self.parse_trade(self.extend({'order_id': id}, transactions[i]), market)
filled += trade['amount']
if feeCost is None:
feeCost = 0.0
feeCost += trade['fee']['cost']
if cost is None:
cost = 0.0
cost += trade['cost']
trades.append(trade)
status = self.safe_string(order, 'status')
if (status == 'In Queue') or (status == 'Open'):
Expand All @@ -440,12 +453,22 @@ def parse_order(self, order, market=None):
side = self.safe_string(order, 'type')
if side is not None:
side = 'sell' if (side == '1') else 'buy'
fee = None
cost = None
if market is None:
market = self.get_market_from_trades(trades)
feeCurrency = None
if market is not None:
symbol = market['symbol']
feeCurrency = market['quote']
if cost is None:
if price is not None:
cost = price * filled
elif price is None:
if filled > 0:
price = cost / filled
fee = {
'cost': feeCost,
'currency': feeCurrency,
}
return {
'id': id,
'datetime': iso8601,
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.1114'
__version__ = '1.10.1115'

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

Expand Down
29 changes: 26 additions & 3 deletions python/ccxt/bitstamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@ def parse_trade(self, trade, market=None):
amount = self.safe_float(trade, market['baseId'], amount)
feeCurrency = market['quote']
symbol = market['symbol']
cost = None
if price is not None:
if amount is not None:
cost = price * amount
return {
'id': id,
'info': trade,
Expand All @@ -312,6 +316,7 @@ def parse_trade(self, trade, market=None):
'side': side,
'price': price,
'amount': amount,
'cost': cost,
'fee': {
'cost': feeCost,
'currency': feeCurrency,
Expand Down Expand Up @@ -417,14 +422,22 @@ def parse_order(self, order, market=None):
if marketId in self.markets_by_id:
market = self.markets_by_id[marketId]
amount = self.safe_float(order, 'amount')
filled = 0
filled = 0.0
trades = []
transactions = self.safe_value(order, 'transactions')
feeCost = None
cost = None
if transactions is not None:
if isinstance(transactions, list):
for i in range(0, len(transactions)):
trade = self.parse_trade(self.extend({'order_id': id}, transactions[i]), market)
filled += trade['amount']
if feeCost is None:
feeCost = 0.0
feeCost += trade['fee']['cost']
if cost is None:
cost = 0.0
cost += trade['cost']
trades.append(trade)
status = self.safe_string(order, 'status')
if (status == 'In Queue') or (status == 'Open'):
Expand All @@ -440,12 +453,22 @@ def parse_order(self, order, market=None):
side = self.safe_string(order, 'type')
if side is not None:
side = 'sell' if (side == '1') else 'buy'
fee = None
cost = None
if market is None:
market = self.get_market_from_trades(trades)
feeCurrency = None
if market is not None:
symbol = market['symbol']
feeCurrency = market['quote']
if cost is None:
if price is not None:
cost = price * filled
elif price is None:
if filled > 0:
price = cost / filled
fee = {
'cost': feeCost,
'currency': feeCurrency,
}
return {
'id': id,
'datetime': iso8601,
Expand Down

0 comments on commit 3ca1cc8

Please sign in to comment.