Beispiel #1
0
trade_option = 'Sell'

option = int(raw_input("1. Automatic\n2. Manual\n"))

# manual variables
if (option == 2):
    coin_name = raw_input("The coin name abbreviation (example ETH): ")
    how_much_bitcoin = float(raw_input("Amount of BTC to pay with : "))
    offset = float(input("Offset rate of the coin pair : "))
    trade_option = raw_input("Buy/Sell : ")

# getting coin stats
coin_pair = coin_name + '_BTC'
market = coin_name + '/BTC'
print("Getting current market status...")
coin_pair_stats = api_wrapper.get_market(coin_pair)
coin_pair_price = coin_pair_stats[0]["LastPrice"]
coin_pair_price = float(format(coin_pair_price, '.8f'))
print("Current exchange rate : {}".format(coin_pair_price))
if (trade_option == 'Buy'):
    desired_coin_pair_price = float(
        format(coin_pair_price + (coin_pair_price * (offset / float(100))),
               '.8f'))
    print("Desired Exchange rate : {}".format(desired_coin_pair_price))
    amount = round(how_much_bitcoin / desired_coin_pair_price)
    print("Number of coins you can buy : {}".format(amount))
else:
    desired_coin_pair_price = float(
        format(coin_pair_price - (coin_pair_price * (offset / float(100))),
               '.8f'))
    print("Desired Exchange rate : {}".format(desired_coin_pair_price))
Beispiel #2
0
class PumpDumpCyriptopia:
    API = ()

    def __init__(self):
        # setup api
        KEY, SECRET = self.get_secret()
        self.API = Api(KEY, SECRET)

    def get_secret(self):
        return str(config.api_key), str(config.secret)

    def pumpDump(self,
                 SYMBOL,
                 percentageOfBtc=100,
                 profitPercentage=100,
                 buyingPercentage=60):
        # do before entering coin to save the API call during the pump
        BALANCE_BTC, ERROR = self.API.get_balance('BTC')
        if ERROR is not None:
            print ERROR
        PUMP_BALANCE = BALANCE_BTC["Available"] * (percentageOfBtc / 100)
        COIN_PRICE, ERROR = self.API.get_market(SYMBOL + "_BTC")
        if ERROR is not None:
            print ERROR

        ASK_PRICE = COIN_PRICE['AskPrice']

        COIN_SUMMARY, ERROR = self.API.get_market(SYMBOL + "_BTC")
        if ERROR is not None:
            print ERROR

        LAST_PRICE = COIN_SUMMARY['LastPrice']
        CLOSE_PRICE = COIN_SUMMARY['Close']

        ASK_BUY = ASK_PRICE + (buyingPercentage / 100 * ASK_PRICE)
        ASK_SELL = ASK_PRICE + (profitPercentage / 100 * ASK_PRICE)

        # calculates the number of PUMP_COIN(s) to buy, taking into
        # consideration Cryptopia's 0.20% fee.
        c_fee = 0.00201
        cryptoipa_fee = PUMP_BALANCE * c_fee
        NUM_COINS = float((PUMP_BALANCE - cryptoipa_fee)) / ASK_BUY

        if LAST_PRICE > CLOSE_PRICE + 0.20 * CLOSE_PRICE:
            print '\nYou joined too late or this was pre-pumped! \
                       Close Price : {:.8f} . Last Price : {:.8f}'.format(
                CLOSE_PRICE, LAST_PRICE)
            return

        BUY_PRICE = ASK_BUY * NUM_COINS
        SELL_PRICE = ASK_SELL * NUM_COINS
        PROFIT = SELL_PRICE - BUY_PRICE

        print '\n[+] Buy order placed for {:.8f} {} coins at {:.8f} BTC \
                  each for a total of {} BTC'.format(NUM_COINS, SYMBOL,
                                                     ASK_BUY, BUY_PRICE)

        # TRADE, ERROR = self.API.submit_trade(SYMBOL + '/BTC', 'Buy', ASK_BUY, NUM_COINS)
        if ERROR is not None:
            print ERROR

        print '\n[+] Placing sell order at {:.8f} (+{}%)...'.format(
            ASK_SELL, profitPercentage)

        COINS_OWNED, ERROR = self.API.get_balance(SYMBOL)
        if ERROR is not None:
            print ERROR

        COINS_OWNED = COINS_OWNED['Available']
        while COINS_OWNED == 0:
            time.sleep(0.1)
            COINS_OWNED, ERROR = self.API.get_balance(SYMBOL)
            if ERROR is not None:
                print ERROR
                break
            COINS_OWNED = COINS_OWNED['Available']

        TRADE, ERROR = self.API.submit_trade(SYMBOL + '/BTC', 'Sell', ASK_SELL,
                                             NUM_COINS)
        if ERROR is not None:
            print ERROR

        print '\n[+] Sell order placed of {:.8f} {} coins at {:.8f} BTC each for \
                  a total of {:.8f} BTC'.format(NUM_COINS, SYMBOL, ASK_SELL,
                                                SELL_PRICE)

        print '[*] PROFIT if sell order fills: {:.8f} BTC'.format(PROFIT)
Beispiel #3
0
        print('\nLive Mode Active! Real orders will be placed.\n\n\
               Press CTRL+C to exit at anytime.\n')
    print('You have {} BTC available.'.format(AVAILABLE_BTC))
    PUMP_BALANCE = float(input("How much BTC would you like to use?: "))
    while PUMP_BALANCE > AVAILABLE_BTC:
        print('You can\'t invest more than {}'.format(AVAILABLE_BTC))
        PUMP_BALANCE = float(input("How much BTC would you like to use?: "))

    PUMP_BUY = float(input("\nBuy Above Current Ask by what %: "))
    PUMP_SELL = float(input("Sell Above Current Ask by what %: "))
    print('\n*Orders will send immediately after entering coin ticker symbol. \
           Assure accuracy!\nType in one case only, i.e. XVG or xvg, not Xvg\n'
          )
    PUMP_COIN = input("Coin Ticker Symbol: ")

    COIN_PRICE, ERROR = API.get_market(PUMP_COIN + "_BTC")
    if ERROR is not None:
        print(ERROR)
        break
    ASK_PRICE = COIN_PRICE['AskPrice']

    COIN_SUMMARY, ERROR = API.get_market(PUMP_COIN + "_BTC")
    if ERROR is not None:
        print(ERROR)
        break
    LAST_PRICE = COIN_SUMMARY['LastPrice']
    CLOSE_PRICE = COIN_SUMMARY['Close']

    if LAST_PRICE > CLOSE_PRICE + 0.20 * CLOSE_PRICE:
        print('\nYou joined too late or this was pre-pumped! \
               Close Price : {:.8f} . Last Price : {:.8f}'.format(
        ALLOW_ORDERS = True
        print '\nLive Mode Active! Real orders will be placed.\n\n\
               Press CTRL+C to exit at anytime.\n'
    print 'You have {} BTC available.'.format(AVAILABLE_BTC)
    PUMP_BALANCE = float(raw_input("How much BTC would you like to use?: "))
    while PUMP_BALANCE > AVAILABLE_BTC:
        print 'You can\'t invest more than {}'.format(AVAILABLE_BTC)
        PUMP_BALANCE = float(raw_input("How much BTC would you like to use?: "))

    PUMP_BUY = float(raw_input("\nBuy Above Current Ask by what %: "))
    PUMP_SELL = float(raw_input("Sell Above Current Ask by what %: "))
    print '\n*Orders will send immediately after entering coin ticker symbol. \
           Assure accuracy!\nType in one case only, i.e. XVG or xvg, not Xvg\n'
    PUMP_COIN = raw_input("Coin Ticker Symbol: ")

    COIN_PRICE, ERROR = API.get_market(PUMP_COIN + "_BTC")
    if ERROR is not None:
        print ERROR
        break
    ASK_PRICE = COIN_PRICE['AskPrice']

    COIN_SUMMARY, ERROR = API.get_market(PUMP_COIN + "_BTC")
    if ERROR is not None:
        print ERROR
        break
    LAST_PRICE = COIN_SUMMARY['LastPrice']
    CLOSE_PRICE = COIN_SUMMARY['Close']

    if LAST_PRICE > CLOSE_PRICE + 0.20 * CLOSE_PRICE:
        print '\nYou joined too late or this was pre-pumped! \
               Close Price : {:.8f} . Last Price : {:.8f}'.format(CLOSE_PRICE, LAST_PRICE)