def test_order(self): upbit = Upbitpy(self.KEY, self.SECRET) ret = upbit.order(self.TEST_MARKET, 'bid', self.TEST_VOLUME, self.TEST_BID_PRICE) self.assertIsNotNone(ret) self.assertNotEqual(len(ret), 0) logging.info(ret) self.__do_cancel(upbit)
def order(self, code, dir, price, qty): logging.info('%s, %s, %f, %f'%(code,dir,price,qty)) try: upbit = Upbitpy(self.KEY, self.SECRET) ret = upbit.order(code, dir, qty, price) #e.g. ('KRW-BTC', 'bid', 10, 300) logging.info(ret) except: logging.info('Order Err')
from upbitpy import Upbitpy if __name__ == '__main__': print("") print("") print("start") access = "xIHcZKYQQxO9xmsLSxDOrP9LJxk5RvgQCHt8H5GK" secret = "I91StxEjUU1UPpz8bu6HL1kTCLihRenHj6aGFzxm" # 키들은 본인의 키를입력합니다.# upbit = Upbitpy(access, secret) ret = upbit.get_accounts() print(ret) now_price = 10 # buy ret = upbit.order('KRW-XRP', 'bid', 100, now_price) #sell ret = upbit.order('KRW-XRP', 'ask', 100, now_price) print("end")