Skip to content

Commit

Permalink
fixes for fetchTrades test
Browse files Browse the repository at this point in the history
  • Loading branch information
kroitor committed Aug 12, 2017
1 parent 4be0df6 commit 951db1d
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 33 deletions.
8 changes: 7 additions & 1 deletion ccxt.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ const Exchange = function (config) {

if (this.markets)
this.setMarkets (this.markets);

this.orders = {}
}

this.fetch = function (url, method = 'GET', headers = undefined, body = undefined) {
Expand Down Expand Up @@ -708,6 +710,10 @@ var _1broker = {
};
},

async fetchTrades (market) {
throw new ExchangeError (this.id + ' fetchTrades () method not implemented yet')
},

async fetchTicker (market) {
await this.loadMarkets ();
let result = await this.privateGetMarketBars ({
Expand Down Expand Up @@ -6787,7 +6793,7 @@ var coingi = {
},

async fetchTrades (market) {
return this.publicGetTransactionsPairMaxCount ({
return this.currentGetTransactionsPairMaxCount ({
'pair': this.marketId (market),
});
},
Expand Down
40 changes: 21 additions & 19 deletions ccxt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
'zaif',
]

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

__all__ = exchanges + [
'exchanges',
'Exchange',
Expand All @@ -86,8 +88,12 @@
'ExchangeNotAvailable',
]

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

__version__ = '1.3.51'

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

# Python 2 & 3
import base64
import calendar
Expand All @@ -108,38 +114,33 @@
import zlib
import decimal

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

try:
import urllib.parse as _urlencode # Python 3
import urllib.request as _urllib
except ImportError:
import urllib as _urlencode # Python 2
import urllib2 as _urllib

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

try:
basestring # Python 3
except NameError:
basestring = str # Python 2

class CCXTError (Exception):
pass

class ExchangeError (CCXTError):
pass

class AuthenticationError (CCXTError):
pass

class NetworkError (CCXTError):
pass

class DDoSProtection (NetworkError):
pass
#------------------------------------------------------------------------------

class RequestTimeout (NetworkError):
pass
class CCXTError (Exception): pass
class ExchangeError (CCXTError): pass
class AuthenticationError (CCXTError): pass
class NetworkError (CCXTError): pass
class DDoSProtection (NetworkError): pass
class RequestTimeout (NetworkError): pass
class ExchangeNotAvailable (NetworkError): pass

class ExchangeNotAvailable (NetworkError):
pass
#------------------------------------------------------------------------------

class Exchange (object):

Expand All @@ -148,10 +149,11 @@ class Exchange (object):
timeout = 10000 # milliseconds = seconds * 1000
userAgent = False
verbose = False
markets = None
markets = None
symbols = None
currencies = None
tickers = None
orders = {}
proxy = ''
apiKey = ''
secret = ''
Expand Down
34 changes: 21 additions & 13 deletions transpile.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,21 @@ while (exchanges = regex.exec (contents)) {

method = method.replace ('fetchBalance', 'fetch_balance')
// .replace ('fetchCategories', 'fetch_categories')
.replace ('fetchMarkets', 'fetch_markets')
.replace ('fetchOrderBook', 'fetch_order_book')
.replace ('fetchTickers', 'fetch_tickers')
.replace ('fetchTicker', 'fetch_ticker')
.replace ('parseTicker', 'parse_ticker')
.replace ('parseBidAsk', 'parse_bidask')
.replace ('parseBidAsks', 'parse_bidasks')
.replace ('fetchTrades', 'fetch_trades')
.replace ('createOrder', 'create_order')
.replace ('cancelOrder', 'cancel_order')
.replace ('signIn', 'sign_in')
.replace ('fetchMarkets', 'fetch_markets')
.replace ('fetchOrderBook', 'fetch_order_book')
.replace ('fetchTickers', 'fetch_tickers')
.replace ('fetchTicker', 'fetch_ticker')
.replace ('parseTicker', 'parse_ticker')
.replace ('parseTrades', 'parse_trades')
.replace ('parseTrade', 'parse_trade')
.replace ('parseBidAsks', 'parse_bidasks')
.replace ('parseBidAsk', 'parse_bidask')
.replace ('fetchTrades', 'fetch_trades')
.replace ('fetchMyTrades', 'fetch_my_trades')
.replace ('fetchAllMyTrades', 'fetch_all_my_trades')
.replace ('createOrder', 'create_order')
.replace ('cancelOrder', 'cancel_order')
.replace ('signIn', 'sign_in')

args = args.length ? args.split (',').map (x => x.trim ()) : []
let phArgs = args.join (', $').trim ()
Expand Down Expand Up @@ -109,8 +113,10 @@ while (exchanges = regex.exec (contents)) {
[ /\.implodeParams/g, '.implode_params'],
[ /\.extractParams/g, '.extract_params'],
[ /\.parseTicker/g, '.parse_ticker'],
[ /\.parseBidAsk/g, '.parse_bidask'],
[ /\.parseTrades/g, '.parse_trades'],
[ /\.parseTrade/g, '.parse_trade'],
[ /\.parseBidAsks/g, '.parse_bidasks'],
[ /\.parseBidAsk/g, '.parse_bidask'],
[ /\.indexBy/g, '.index_by'],
[ /\.sortBy/g, '.sort_by'],
[ /\.marketId/g, '.market_id'],
Expand Down Expand Up @@ -174,8 +180,10 @@ while (exchanges = regex.exec (contents)) {
[ /this\.stringToBase64/g, 'base64_encode' ],
[ /this\.base64ToBinary/g, 'base64_decode' ],
[ /\.parseTicker/g, '.parse_ticker'],
[ /\.parseBidAsk/g, '.parse_bidask'],
[ /\.parseTrades/g, '.parse_trades'],
[ /\.parseTrade/g, '.parse_trade'],
[ /\.parseBidAsks/g, '.parse_bidasks'],
[ /\.parseBidAsk/g, '.parse_bidask'],
[ /\.binaryConcat/g, '.binary_concat'],
[ /\.binaryToString/g, '.binary_to_string' ],
[ /\.implodeParams/g, '.implode_params'],
Expand Down

0 comments on commit 951db1d

Please sign in to comment.