def get_hist_trades(symbol, size=None): """ :param symbol: range: { ethcny } :return: """ params = {'symbol': symbol} update(params, {'size': size}) url = MARKET_URL + '/market/history/trade' return publicReq(url, 'GET', params=params)
def __init__(self, rules): self.rules_by_non_terminal = {} self.first_rules = {} self.trans = {} self.rules_by_non_terminal = rules self.get_firsts() # update(first_rules, trans) self.first_accept_epsilon() helper.update(self.first_rules, self.trans, -1)
def get_depth(symbol, type, depth=None): """ :param symbol: :param type: range: { percent10, step0, step1, step2, step3, step4, step5 } :return: """ params = {'symbol': symbol, 'type': type} update(params, {'depth': depth}) url = MARKET_URL + '/market/depth' return publicReq(url, 'GET', params=params)
def get_kline(symbol, period, size=None): """ :param symbol :param period: range: {1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year} :param size: [1,2000] :return: """ params = {'symbol': symbol, 'period': period} update(params, {'size': size}) url = MARKET_URL + '/market/history/kline' return publicReq(url, 'GET', params=params)
def orders_matchresults(symbols=None, types=None, start_date=None, end_date=None, _from=None, direct=None, size=None): """ :param symbol: :param types: range {buy-market, sell-market, buy-limit, sell-limit} :param start_date: :param end_date: :param _from: :param direct: range {prev, next} :param size: :return: """ params = {} optional = {'symbols': symbols, 'types': types, 'start_date': start_date, 'end_date': end_date, 'from': _from, 'direct': direct, 'size': size} update(params, optional) url = TRADE_URL + '/v1/order/matchresults' return privateReq(url, 'GET', params=params)
def orders_list(states, symbols=None, types=None, start_date=None, end_date=None, _from=None, direct=None, size=None): """ :param symbol: :param states: range {pre-submitted, submitted, partial-filled, partial-canceled, filled, canceled} :param types: range {buy-market, sell-market, buy-limit, sell-limit} :param start_date: :param end_date: :param _from: :param direct: range{prev, next} :param size: :return: """ params = {'states': states} optional = {'symbols': symbols, 'types': types, 'start-date': start_date, 'end-date': end_date, 'from': _from, 'direct': direct, 'size': size} update(params, optional) url = TRADE_URL + '/v1/order/orders' return privateReq(url, 'GET', params=params)
def withdraw(address, amount, currency, fee=None, addr_tag=None): """ :param address_id: :param amount: :param currency:btc, ltc, bcc, eth, etc ... :param fee: :param addr_tag: :return: { "status": "ok", "data": 700 } """ params = {'address': address, 'amount': amount, "currency": currency} optional = {"fee": fee, "addr-tag": addr_tag} update(params, optional) url = TRADE_URL + '/v1/dw/withdraw/api/create' return privateReq(url, 'POST', data=params)
def nn_model(X, Y, n_h, num_iterations=10000, print_cost=True): a, b, c = net_size(X, Y) b = n_h param = initial_param(a, b, c) for i in range(0, num_iterations): A2, cache = forward_prop(X, param) c = cost(A2, Y) grads = back_prop(param, cache, X, Y) param = update(param, grads) if print_cost and i % 1000 == 0: print('Cost is ' + str(c)) return param
def update(self, samples): """Replace the samples in the cluster by new samples Return: how much the centroid has changed""" return helper.update(self, samples)
def update(self, new_samples): """Replace the samples in the cluster by new samples Return: how much the centroid has changed""" #------- your code below -----------# return helper.update(self, new_samples)
def __init__(self, rules, first_rules): self.follow_rules = {} self.follow_trans = {} self.follow(rules, first_rules) helper.update(self.follow_rules, self.follow_trans, -1)