예제 #1
0
파일: bitstamp.py 프로젝트: ttwishing/anyex
 def withdraw(self, code, amount, address, tag=None, params={}):
     self.check_address(address)
     if self.is_fiat(code):
         raise NotSupported(self.id + ' fiat withdraw() for ' + code +
                            ' is not implemented yet')
     name = self.get_currency_name(code)
     request = {
         'amount': amount,
         'address': address,
     }
     v1 = (code == 'BTC')
     method = 'v1' if v1 else 'private'  # v1 or v2
     method += 'Post' + self.capitalize(name) + 'Withdrawal'
     query = params
     if code == 'XRP':
         if tag is not None:
             request['destination_tag'] = tag
             query = self.omit(params, 'destination_tag')
         else:
             raise ExchangeError(
                 self.id +
                 ' withdraw() requires a destination_tag param for ' + code)
     response = getattr(self, method)(self.extend(request, query))
     return {
         'info': response,
         'id': response['id'],
     }
예제 #2
0
 async def fetch_ticker(self, symbol, params={}):
     if symbol != 'BTC/JPY':
         raise NotSupported(self.id +
                            ' fetchTicker() supports BTC/JPY only')
     ticker = await self.publicGetTicker(params)
     timestamp = ticker['timestamp'] * 1000
     last = float(ticker['last'])
     return {
         'symbol': symbol,
         'timestamp': timestamp,
         'datetime': self.iso8601(timestamp),
         'high': float(ticker['high']),
         'low': float(ticker['low']),
         'bid': float(ticker['bid']),
         'bidVolume': None,
         'ask': float(ticker['ask']),
         'askVolume': None,
         'vwap': None,
         'open': None,
         'close': last,
         'last': last,
         'previousClose': None,
         'change': None,
         'percentage': None,
         'average': None,
         'baseVolume': float(ticker['volume']),
         'quoteVolume': None,
         'info': ticker,
     }
예제 #3
0
파일: gdax.py 프로젝트: ttwishing/anyex
 async def deposit(self, currency, amount, address, params={}):
     await self.load_markets()
     request = {
         'currency': currency,
         'amount': amount,
     }
     method = 'privatePostDeposits'
     if 'payment_method_id' in params:
         # deposit from a payment_method, like a bank account
         method += 'PaymentMethod'
     elif 'coinbase_account_id' in params:
         # deposit into GDAX account from a Coinbase account
         method += 'CoinbaseAccount'
     else:
         # deposit methodotherwise we did not receive a supported deposit location
         # relevant docs link for the Googlers
         # https://docs.gdax.com/#deposits
         raise NotSupported(
             self.id +
             ' deposit() requires one of `coinbase_account_id` or `payment_method_id` extra params'
         )
     response = await getattr(self, method)(self.extend(request, params))
     if not response:
         raise ExchangeError(self.id + ' deposit() error: ' +
                             self.json(response))
     return {
         'info': response,
         'id': response['id'],
     }
예제 #4
0
 async def create_order(self,
                        symbol,
                        type,
                        side,
                        amount,
                        price=None,
                        params={}):
     raise NotSupported(self.id + ' createOrder not implemented yet')
예제 #5
0
파일: cex.py 프로젝트: ttwishing/anyex
 def fetch_closed_orders(self, symbol=None, since=None, limit=None, params={}):
     self.load_markets()
     method = 'privatePostArchivedOrdersPair'
     if symbol is None:
         raise NotSupported(self.id + ' fetchClosedOrders requires a symbol argument')
     market = self.market(symbol)
     request = {'pair': market['id']}
     response = getattr(self, method)(self.extend(request, params))
     return self.parse_orders(response, market, since, limit)
예제 #6
0
 def fetch_orders(self, symbol=None, since=None, limit=None, params={}):
     if not symbol:
         raise NotSupported(self.id +
                            ': fetchOrders requires a `symbol` parameter.')
     self.load_markets()
     market = self.market(symbol)
     request = self.prepare_history_request(market, since, limit)
     response = self.privatePostOrderHistory(self.extend(request, params))
     return self.parse_orders(response['orders'], market)
예제 #7
0
 async def fetch_open_orders(self, symbol=None, since=None, limit=None, params={}):
     if not symbol:
         raise NotSupported(self.id + ' fetchOpenOrders requires a symbol param')
     await self.load_markets()
     market = self.market(symbol)
     orders = await self.privatePostIdOpenOrders({
         'id': market['id'],
     })
     for i in range(0, len(orders)):
         # Coinfloor open orders would always be limit orders
         orders[i] = self.extend(orders[i], {'status': 'open'})
     return self.parse_orders(orders, market, since, limit)
예제 #8
0
 def fetch_trades(self, symbol, since=None, limit=None, params={}):
     if symbol != 'BTC/JPY':
         raise NotSupported(self.id + ' fetchTrades() supports BTC/JPY only')
     market = self.market(symbol)
     response = self.publicGetTrades(self.extend({
         'pair': market['id'],
     }, params))
     if 'success' in response:
         if response['success']:
             if response['data'] is not None:
                 return self.parse_trades(response['data'], market, since, limit)
     raise ExchangeError(self.id + ' ' + self.json(response))
예제 #9
0
 async def fetch_my_trades(self,
                           symbol=None,
                           since=None,
                           limit=None,
                           params={}):
     if not symbol:
         raise NotSupported(
             self.id + ': fetchMyTrades requires a `symbol` parameter.')
     await self.load_markets()
     market = self.market(symbol)
     request = self.prepare_history_request(market, since, limit)
     response = await self.privatePostOrderTradeHistory(
         self.extend(request, params))
     return self.parse_my_trades(response['trades'], market)
예제 #10
0
파일: bitlish.py 프로젝트: ttwishing/anyex
 def withdraw(self, currency, amount, address, tag=None, params={}):
     self.check_address(address)
     self.load_markets()
     if currency != 'BTC':
         # they did not document other types...
         raise NotSupported(self.id + ' currently supports BTC withdrawals only, until they document other currencies...')
     response = self.privatePostWithdraw(self.extend({
         'currency': currency.lower(),
         'amount': float(amount),
         'account': address,
         'payment_method': 'bitcoin',  # they did not document other types...
     }, params))
     return {
         'info': response,
         'id': response['message_id'],
     }
예제 #11
0
파일: bitfinex.py 프로젝트: ttwishing/anyex
 def get_currency_name(self, currency):
     names = {
         'AID': 'aid',
         'AVT': 'aventus',  # #1811
         'BAT': 'bat',
         'BCH': 'bcash',  # undocumented
         'BTC': 'bitcoin',
         'BTG': 'bgold',
         'DASH': 'dash',
         'DATA': 'datacoin',
         'EDO': 'eidoo',  # #1811
         'ELF': 'elf',
         'EOS': 'eos',
         'ETC': 'ethereumc',
         'ETH': 'ethereum',
         'FUN': 'fun',
         'GNT': 'golem',
         'IOTA': 'iota',
         'LTC': 'litecoin',
         'MANA': 'mna',
         'NEO': 'neo',  # #1811
         'OMG': 'omisego',
         'OMNI': 'mastercoin',
         'QASH': 'qash',
         'QTUM': 'qtum',  # #1811
         'RCN': 'rcn',
         'REP': 'rep',
         'RLC': 'rlc',
         'SAN': 'santiment',
         'SNGLS': 'sng',
         'SNT': 'status',
         'SPANK': 'spk',
         'TNB': 'tnb',
         'TRX': 'trx',
         'USD': 'wire',
         'USDT': 'tetheruso',  # undocumented
         'XMR': 'monero',
         'XRP': 'ripple',
         'YOYOW': 'yoyow',
         'ZEC': 'zcash',
         'ZRX': 'zrx',
     }
     if currency in names:
         return names[currency]
     raise NotSupported(self.id + ' ' + currency +
                        ' not supported for withdrawal')
예제 #12
0
파일: cex.py 프로젝트: ttwishing/anyex
 def fetch_deposit_address(self, code, params={}):
     if code == 'XRP':
         # https://github.com/anyex/anyex/pull/2327#issuecomment-375204856
         raise NotSupported(self.id + ' fetchDepositAddress does not support XRP addresses yet(awaiting docs from CEX.io)')
     self.load_markets()
     currency = self.currency(code)
     request = {
         'currency': currency['id'],
     }
     response = self.privatePostGetAddress(self.extend(request, params))
     address = self.safe_string(response, 'data')
     self.check_address(address)
     return {
         'currency': code,
         'address': address,
         'tag': None,
         'status': 'ok',
         'info': response,
     }
예제 #13
0
 async def fetch_deposit_address(self, code, params={}):
     if self.is_fiat(code):
         raise NotSupported(self.id + ' fiat fetchDepositAddress() for ' + code + ' is not implemented yet')
     name = self.get_currency_name(code)
     v1 = (code == 'BTC')
     method = 'v1' if v1 else 'private'  # v1 or v2
     method += 'Post' + self.capitalize(name)
     method += 'Deposit' if v1 else ''
     method += 'Address'
     response = await getattr(self, method)(params)
     address = response if v1 else self.safe_string(response, 'address')
     tag = None if v1 else self.safe_string(response, 'destination_tag')
     self.check_address(address)
     return {
         'currency': code,
         'status': 'ok',
         'address': address,
         'tag': tag,
         'info': response,
     }
예제 #14
0
파일: xbtce.py 프로젝트: ttwishing/anyex
 async def fetch_ohlcv(self,
                       symbol,
                       timeframe='1m',
                       since=None,
                       limit=None,
                       params={}):
     #     minutes = int(timeframe / 60)  # 1 minute by default
     #     periodicity = str(minutes)
     #     await self.load_markets()
     #     market = self.market(symbol)
     #     if not since:
     #         since = self.seconds() - 86400 * 7  # last day by defulat
     #     if not limit:
     #         limit = 1000  # default
     #     response = await self.privateGetQuotehistorySymbolPeriodicityBarsBid(self.extend({
     #         'symbol': market['id'],
     #         'periodicity': periodicity,
     #         'timestamp': since,
     #         'count': limit,
     #     }, params))
     #     return self.parse_ohlcvs(response['Bars'], market, timeframe, since, limit)
     raise NotSupported(self.id + ' fetchOHLCV is disabled by the exchange')
예제 #15
0
파일: _1broker.py 프로젝트: ttwishing/anyex
 def fetch_trades(self, symbol):
     raise NotSupported(self.id +
                        ' fetchTrades() method not implemented yet')
예제 #16
0
파일: exchange.py 프로젝트: ttwishing/anyex
 def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
     raise NotSupported(self.id + ' sign() pure method must be redefined in derived classes')
예제 #17
0
 def cancel_order(self, id, symbol=None, params={}):
     self.load_markets()
     # method = 'privateDeleteUserExchangeAskCancelOrderId'  # TODO fixme, have to specify order side here
     # return getattr(self, method)({'orderID': id})
     raise NotSupported(self.id + ' cancelOrder() is not fully implemented yet')
예제 #18
0
 async def fetch_order_book(self, symbol, limit=None, params={}):
     if symbol != 'BTC/JPY':
         raise NotSupported(self.id +
                            ' fetchOrderBook() supports BTC/JPY only')
     orderbook = await self.publicGetOrderBooks(params)
     return self.parse_order_book(orderbook)
예제 #19
0
 async def perform_order_book_request(self, market, limit=None, params={}):
     raise NotSupported(self.id + ' performOrderBookRequest not supported yet')
예제 #20
0
 def withdraw(self, currency, amount, address, tag=None, params={}):
     raise NotSupported(self.id + ' withdraw not implemented yet')
예제 #21
0
 def fetch_deposit_address(self, currency, params={}):
     raise NotSupported(self.id +
                        ' fetchDepositAddress() not implemented yet.')
예제 #22
0
 def fetch_order(self, id, symbol=None, params={}):
     raise NotSupported(self.id + ' fetchOrder is not implemented yet')
예제 #23
0
 def cancel_order(self, id, symbol=None, params={}):
     raise NotSupported(self.id + ' cancelOrder not implemented yet')