Ejemplo n.º 1
0
def get_amount_fx():
    trader = TradeMethodOld('FX_BTC_JPY')
    amount = trader.calc_entry_amount_price()
    result = trader.buy_signal(amount, 0, True)
    while not trader.is_completed(result[1]):
        print('.', end="")
        time.sleep(1)
    print(trader.calc_close_amount_price())
Ejemplo n.º 2
0
def order_fx():
    trader = TradeMethodOld('FX_BTC_JPY')
    fee = trader.wrap.get_my_tradingcommission()
    print(fee)
    assert (fee == 0)

    # permissions  = trader.wrap.get_my_permissions()
    # print(permissions)
    collateral = trader.wrap.get_my_collateral()
    positions = trader.wrap.get_my_positions()
    print(collateral)
    print(positions)

    print(trader.get_position())
    result = trader.sell_signal(0.01, 0, True)
    while not trader.is_completed(result[1]):
        print('.', end="")
        time.sleep(1)
    print()
    print(trader.get_position())

    collateral = trader.wrap.get_my_collateral()
    positions = trader.wrap.get_my_positions()
    print(collateral)
    print(positions)

    result = trader.buy_signal(0.01, 0, True)
    while not trader.is_completed(result[1]):
        print('.', end="")
        time.sleep(1)
    print(trader.get_position())
    print(result)
Ejemplo n.º 3
0
import time
from typing import Literal
from util import next_sleep

from config import config as tconf
from logic import SnakeLogic
from services.slackcli import (close_notice, error_notice, long_entry_notice,
                               short_entry_notice, start_notice)
# from pprint import pprint
from trade_method_old import TradeMethod

# 実行クラス
trader = TradeMethod("FX_BTC_JPY")
logic = SnakeLogic(tconf.snake_size, market='bitflyer', pair="btcfxjpy")


class TradeController:
    def __init__(self):
        self.posi: Literal["none", "shor", "long"] = "none"
        trader.wait_ordarable()

        self.posi = trader.get_position()
        print("Initialize completed")

    def run(self):
        print(self.posi)
        while True:
            if self.posi == 'none':
                self.none_step()
            elif self.posi == 'long':
                self.long_step()
Ejemplo n.º 4
0
Archivo: _main.py Proyecto: elzup/otoro
import time
from util import next_sleep

from config import config as tconf
from logic import ExecLogic
# from pprint import pprint
from trade_method_old import TradeMethod
from services.slackcli import buy_notice, sell_notice, start_notice

# フラグ設定
buy_jdg = "buy_jdg"
sell_jdg = "sell_jdg"

# 実行クラス
trader = TradeMethod()
logic = ExecLogic()

# trader.cancel_all_orders()


class TradeController:
    def __init__(self):
        self.thread_flag = buy_jdg
        self.trade_comp()
        while trader.get_open_order() is not None:
            time.sleep(5)
        r = trader.get_open_order()
        if r is not None:
            self.set_trade(r["child_order_acceptance_id"])
            if r["side"] == "BUY":
                self.thread_flag = sell_jdg
Ejemplo n.º 5
0
def order_wait():
    trader = TradeMethodOld()
    # trader.buy_signal(0.001, True)
    orders = trader.get_open_order()
    print(orders)
Ejemplo n.º 6
0
def get_orders():
    trader = TradeMethodOld()
    orders = trader.get_open_order()
    print(orders)
Ejemplo n.º 7
0
def check_trade():
    trader = TradeMethodOld('FX_BTC_JPY')
    trade_id = 'JRF20200908-082627-088433'
    print(trader.is_completed(trade_id))
Ejemplo n.º 8
0
def current_posision():
    trader = TradeMethodOld('FX_BTC_JPY')
    print(trader.get_position())
Ejemplo n.º 9
0
def full_short():
    trader = TradeMethodOld('FX_BTC_JPY')
    trader.entry_full_short()
Ejemplo n.º 10
0
def full_long():
    trader = TradeMethodOld('FX_BTC_JPY')
    trader.entry_full_long()
    trader.close_full_long()
    print(trader.calc_close_amount_price())