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 Jan 5, 2018
2 parents 4963610 + 7f416a7 commit a9d9521
Show file tree
Hide file tree
Showing 14 changed files with 137 additions and 111 deletions.
64 changes: 35 additions & 29 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.569'
const version = '1.10.570'

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.569",
"version": "1.10.570",
"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.569';
$version = '1.10.570';

abstract class Exchange {

Expand Down
54 changes: 30 additions & 24 deletions php/btctradeua.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,28 +182,22 @@ public function fetch_ticker ($symbol, $params = array ()) {

public function convert_cyrillic_month_name_to_string ($cyrillic) {
$months = array (
'января',
'февраля',
'марта',
'апреля',
'мая',
'июня',
'июля',
'августа',
'сентября',
'октября',
'ноября',
'декабря',
'января' => '01',
'февраля' => '02',
'марта' => '03',
'апреля' => '04',
'мая' => '05',
'июня' => '06',
'июля' => '07',
'августа' => '08',
'сентября' => '09',
'октября' => '10',
'ноября' => '11',
'декабря' => '12',
);
$month = null;
for ($i = 0; $i < count ($months); $i++) {
if ($cyrillic == $months[$i]) {
$month = $i . 1;
$month = (string) $month;
if ($i < 9)
$month = '0' . $month;
}
}
if (is_array ($months) && array_key_exists ($cyrillic, $months))
$month = $months[$cyrillic];
return $month;
}

Expand All @@ -219,11 +213,21 @@ public function parse_cyrillic_datetime ($cyrillic) {
if ($hmsLength == 7) {
$hms = '0' . $hms;
}
if (strlen ($day) == 1) {
$day = '0' . $day;
}
$ymd = implode ('-', array ($year, $month, $day));
$ymdhms = $ymd . 'T' . $hms;
$timestamp = $this->parse8601 ($ymdhms);
$timestamp = $timestamp - 10800000; // server reports local GMT+3 time, adjust to UTC
return $timestamp;
// server reports local time, adjust to UTC
$md = implode ('', array ($month, $day));
$md = intval ($md);
// a special case for DST
// subtract 2 hours during winter
if ($md < 325 || $md > 1028)
return $timestamp - 7200000;
// subtract 3 hours during summer
return $timestamp - 10800000;
}

public function parse_trade ($trade, $market) {
Expand All @@ -234,8 +238,8 @@ public function parse_trade ($trade, $market) {
'timestamp' => $timestamp,
'datetime' => $this->iso8601 ($timestamp),
'symbol' => $market['symbol'],
'type' => null,
'side' => null,
'type' => 'limit',
'side' => $trade['type'],
'price' => floatval ($trade['price']),
'amount' => floatval ($trade['amnt_trade']),
);
Expand All @@ -246,6 +250,8 @@ public function fetch_trades ($symbol, $since = null, $limit = null, $params = a
$response = $this->publicGetDealsSymbol (array_merge (array (
'symbol' => $market['id'],
), $params));
// they report each trade twice (once for both of the two sides of the fill)
// deduplicate $trades for that reason
$trades = array ();
for ($i = 0; $i < count ($response); $i++) {
if (fmod ($response[$i]['id'], 2)) {
Expand Down
2 changes: 1 addition & 1 deletion php/liqui.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public function describe () {
'id' => 'liqui',
'name' => 'Liqui',
'countries' => 'UA',
'rateLimit' => 2500,
'rateLimit' => 3000,
'version' => '3',
'hasCORS' => false,
// obsolete metainfo interface
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.569'
__version__ = '1.10.570'

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

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.569'
__version__ = '1.10.570'

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

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.569'
__version__ = '1.10.570'

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

Expand Down
55 changes: 31 additions & 24 deletions python/ccxt/async/btctradeua.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,27 +172,23 @@ async def fetch_ticker(self, symbol, params={}):
return result

def convert_cyrillic_month_name_to_string(self, cyrillic):
months = [
u'января',
u'февраля',
u'марта',
u'апреля',
u'мая',
u'июня',
u'июля',
u'августа',
u'сентября',
u'октября',
u'ноября',
u'декабря',
]
months = {
u'января': '01',
u'февраля': '02',
u'марта': '03',
u'апреля': '04',
u'мая': '05',
u'июня': '06',
u'июля': '07',
u'августа': '08',
u'сентября': '09',
u'октября': '10',
u'ноября': '11',
u'декабря': '12',
}
month = None
for i in range(0, len(months)):
if cyrillic == months[i]:
month = i + 1
month = str(month)
if i < 9:
month = '0' + month
if cyrillic in months:
month = months[cyrillic]
return month

def parse_cyrillic_datetime(self, cyrillic):
Expand All @@ -206,11 +202,20 @@ def parse_cyrillic_datetime(self, cyrillic):
hmsLength = len(hms)
if hmsLength == 7:
hms = '0' + hms
if len(day) == 1:
day = '0' + day
ymd = '-'.join([year, month, day])
ymdhms = ymd + 'T' + hms
timestamp = self.parse8601(ymdhms)
timestamp = timestamp - 10800000 # server reports local GMT+3 time, adjust to UTC
return timestamp
# server reports local time, adjust to UTC
md = ''.join([month, day])
md = int(md)
# a special case for DST
# subtract 2 hours during winter
if md < 325 or md > 1028:
return timestamp - 7200000
# subtract 3 hours during summer
return timestamp - 10800000

def parse_trade(self, trade, market):
timestamp = self.parse_cyrillic_datetime(trade['pub_date'])
Expand All @@ -220,8 +225,8 @@ def parse_trade(self, trade, market):
'timestamp': timestamp,
'datetime': self.iso8601(timestamp),
'symbol': market['symbol'],
'type': None,
'side': None,
'type': 'limit',
'side': trade['type'],
'price': float(trade['price']),
'amount': float(trade['amnt_trade']),
}
Expand All @@ -231,6 +236,8 @@ async def fetch_trades(self, symbol, since=None, limit=None, params={}):
response = await self.publicGetDealsSymbol(self.extend({
'symbol': market['id'],
}, params))
# they report each trade twice(once for both of the two sides of the fill)
# deduplicate trades for that reason
trades = []
for i in range(0, len(response)):
if response[i]['id'] % 2:
Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/async/liqui.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def describe(self):
'id': 'liqui',
'name': 'Liqui',
'countries': 'UA',
'rateLimit': 2500,
'rateLimit': 3000,
'version': '3',
'hasCORS': False,
# obsolete metainfo interface
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.569'
__version__ = '1.10.570'

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

Expand Down
55 changes: 31 additions & 24 deletions python/ccxt/btctradeua.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,27 +172,23 @@ def fetch_ticker(self, symbol, params={}):
return result

def convert_cyrillic_month_name_to_string(self, cyrillic):
months = [
u'января',
u'февраля',
u'марта',
u'апреля',
u'мая',
u'июня',
u'июля',
u'августа',
u'сентября',
u'октября',
u'ноября',
u'декабря',
]
months = {
u'января': '01',
u'февраля': '02',
u'марта': '03',
u'апреля': '04',
u'мая': '05',
u'июня': '06',
u'июля': '07',
u'августа': '08',
u'сентября': '09',
u'октября': '10',
u'ноября': '11',
u'декабря': '12',
}
month = None
for i in range(0, len(months)):
if cyrillic == months[i]:
month = i + 1
month = str(month)
if i < 9:
month = '0' + month
if cyrillic in months:
month = months[cyrillic]
return month

def parse_cyrillic_datetime(self, cyrillic):
Expand All @@ -206,11 +202,20 @@ def parse_cyrillic_datetime(self, cyrillic):
hmsLength = len(hms)
if hmsLength == 7:
hms = '0' + hms
if len(day) == 1:
day = '0' + day
ymd = '-'.join([year, month, day])
ymdhms = ymd + 'T' + hms
timestamp = self.parse8601(ymdhms)
timestamp = timestamp - 10800000 # server reports local GMT+3 time, adjust to UTC
return timestamp
# server reports local time, adjust to UTC
md = ''.join([month, day])
md = int(md)
# a special case for DST
# subtract 2 hours during winter
if md < 325 or md > 1028:
return timestamp - 7200000
# subtract 3 hours during summer
return timestamp - 10800000

def parse_trade(self, trade, market):
timestamp = self.parse_cyrillic_datetime(trade['pub_date'])
Expand All @@ -220,8 +225,8 @@ def parse_trade(self, trade, market):
'timestamp': timestamp,
'datetime': self.iso8601(timestamp),
'symbol': market['symbol'],
'type': None,
'side': None,
'type': 'limit',
'side': trade['type'],
'price': float(trade['price']),
'amount': float(trade['amnt_trade']),
}
Expand All @@ -231,6 +236,8 @@ def fetch_trades(self, symbol, since=None, limit=None, params={}):
response = self.publicGetDealsSymbol(self.extend({
'symbol': market['id'],
}, params))
# they report each trade twice(once for both of the two sides of the fill)
# deduplicate trades for that reason
trades = []
for i in range(0, len(response)):
if response[i]['id'] % 2:
Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/liqui.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def describe(self):
'id': 'liqui',
'name': 'Liqui',
'countries': 'UA',
'rateLimit': 2500,
'rateLimit': 3000,
'version': '3',
'hasCORS': False,
# obsolete metainfo interface
Expand Down

0 comments on commit a9d9521

Please sign in to comment.