Example #1
0
def test_split_symbol():
    try:
        group = ['BTC:USD', 'STEEM/USD']
        pair = [split_pair(symbol) for symbol in group]
        print('original:', group, 'result:', pair, sep=' ')
    except Exception:
        pass
Example #2
0
def get_gecko_price(**kwargs):
    price = None
    for key, value in list(kwargs.items()):
        debug("The value of {} is {}".format(key, value))  # debug
        if key == "pair_":
            price = get_gecko_price_by_pair(value)
        elif key == "symbol_":
            pair = split_pair(value)  # pair=[quote, base]
            price = get_gecko_price_by_pair(pair)
    return price
Example #3
0
def test_feed(symbol):
    """[symbol]  Symbol example: btc/usd or btc:usd."""
    try:
        price = get_gecko_price(symbol_=symbol)
        print(price)
        pair = split_pair(symbol)
        price = get_gecko_price(pair_=pair)
    except Exception as e:
        print_usage()
        print(type(e).__name__, e.args, str(e))
Example #4
0
def test_consolidated_pair():
    symbol = 'STEEM:BTS'  # pair = 'STEEM:BTS' or STEEM/BTS'
    pair = split_pair(symbol)
    pair1, pair2 = get_consolidated_pair(pair[1], pair[0])
    print(symbol, '=', pair1, pair2, sep=' ')
Example #5
0
from dexbot.strategies.external_feeds.process_pair import filter_bit_symbol, filter_prefix_symbol, split_pair
from dexbot.strategies.external_feeds.waves_feed import get_waves_price
""" This is the unit test for getting external feed data from waves DEX.
"""

if __name__ == '__main__':

    symbol = 'BTC/USD'  # quote/base for external exchanges
    print(symbol, "=")
    raw_pair = split_pair(symbol)
    pair = [
        filter_bit_symbol(j)
        for j in [filter_prefix_symbol(i) for i in raw_pair]
    ]

    # Test symbol and pair options for getting price
    pair_price = get_waves_price(pair_=pair)
    if pair_price:
        print("pair price ", pair_price, sep=":")

    current_price = get_waves_price(symbol_=symbol)
    if current_price:
        print("symbol price ", current_price, sep=":")
Example #6
0
 def symbol(self, symbol):
     self._symbol = symbol
     self._pair = split_pair(self._symbol)
Example #7
0
 def __init__(self, exchange, symbol):
     self._alt_exchanges = ['gecko',
                            'waves']  # assume all other exchanges are ccxt
     self._exchange = exchange
     self._symbol = symbol
     self._pair = split_pair(symbol)