コード例 #1
0
 def setup_method(self):
     self.bittrex = BittrexApi(
         api_server="localhost",
         api_key="00000000-0000-0000-0000-000000000000",
         secret_key="secretkey",
         timeout=15.5)
     self.bittrexMockServer = BittrexMockServer()
コード例 #2
0
    def __init__(self, args: list):
        parser = argparse.ArgumentParser(prog='bitzlato-market-maker-keeper')
        self.add_arguments(parser)

        self.arguments = parser.parse_args(args)
        setup_logging(self.arguments)

        self.bands_config = ReloadableConfig(self.arguments.config)
        self.price_feed = PriceFeedFactory().create_price_feed(self.arguments)
        self.spread_feed = create_spread_feed(self.arguments)
        self.control_feed = create_control_feed(self.arguments)
        self.order_history_reporter = create_order_history_reporter(
            self.arguments)

        self.history = History()

        self.bittrex_api = BittrexApi(
            api_server=self.arguments.bittrex_api_server,
            api_key=self.arguments.bittrex_api_key,
            secret_key=self.arguments.bittrex_secret_key,
            timeout=self.arguments.bittrex_timeout)

        self.order_book_manager = OrderBookManager(
            refresh_frequency=self.arguments.refresh_frequency)
        self.order_book_manager.get_orders_with(
            lambda: self.bittrex_api.get_orders(self.pair()))
        self.order_book_manager.get_balances_with(
            lambda: self.bittrex_api.get_balances())
        self.order_book_manager.cancel_orders_with(
            lambda order: self.bittrex_api.cancel_order(order.order_id))
        self.order_book_manager.enable_history_reporting(
            self.order_history_reporter, self.our_buy_orders,
            self.our_sell_orders)
        self.order_book_manager.start()
コード例 #3
0
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import sys
from pyexchange.bittrex import BittrexApi
from pymaker import Wad

bittrex = BittrexApi('https://bittrex.com', sys.argv[1], sys.argv[2], 9.5)

# print(bittrex.get_markets())
# print(bittrex.get_pair('ETH-DAI'))
# print(bittrex.get_all_trades('ETH-DAI'))
# print(f"Balance: {bittrex.get_balances()}")
# order = bittrex.place_order('ETH-DAI', True, Wad.from_number(0.1), Wad.from_number(50))
# order = bittrex.place_order('ETH-DAI', False, Wad.from_number(0.00001), Wad.from_number(50))
# print(f"Placed order: {order}")
# print(f"Balance: {bittrex.get_balances()}")
# print(bittrex.get_trades('ETH-DAI'))
# print(bittrex.get_all_trades('ETH-DAI'))
print(bittrex.cancel_order("16bb9e73-92b6-4e1f-8f59-8d34397eff47"))

print(bittrex.get_orders('ETH-DAI'))
print(f"Balance: {bittrex.get_balances()}")
コード例 #4
0
    def __init__(self, args: list):
        parser = argparse.ArgumentParser(prog='bittrex-market-maker-keeper')

        parser.add_argument(
            "--bittrex-api-server",
            type=str,
            default="https://bittrex.com",
            help=
            "Address of the bittrex API server (default: 'https://bittrex.com')"
        )

        parser.add_argument("--bittrex-api-key",
                            type=str,
                            required=True,
                            help="API key for the bittrex API")

        parser.add_argument("--bittrex-secret-key",
                            type=str,
                            required=True,
                            help="Secret key for the bittrex API")

        parser.add_argument(
            "--bittrex-timeout",
            type=float,
            default=9.5,
            help=
            "Timeout for accessing the bittrex API (in seconds, default: 9.5)")
        parser.add_argument(
            "--pair",
            type=str,
            required=True,
            help="Token pair (sell/buy) on which the keeper will operate")

        parser.add_argument("--config",
                            type=str,
                            required=True,
                            help="Bands configuration file")

        parser.add_argument("--price-feed",
                            type=str,
                            required=True,
                            help="Source of price feed")

        parser.add_argument(
            "--price-feed-expiry",
            type=int,
            default=120,
            help="Maximum age of the price feed (in seconds, default: 120)")

        parser.add_argument("--spread-feed",
                            type=str,
                            help="Source of spread feed")

        parser.add_argument(
            "--spread-feed-expiry",
            type=int,
            default=3600,
            help="Maximum age of the spread feed (in seconds, default: 3600)")

        parser.add_argument("--control-feed",
                            type=str,
                            help="Source of control feed")

        parser.add_argument(
            "--control-feed-expiry",
            type=int,
            default=86400,
            help="Maximum age of the control feed (in seconds, default: 86400)"
        )

        parser.add_argument("--order-history",
                            type=str,
                            help="Endpoint to report active orders to")

        parser.add_argument(
            "--order-history-every",
            type=int,
            default=30,
            help=
            "Frequency of reporting active orders (in seconds, default: 30)")

        parser.add_argument(
            "--refresh-frequency",
            type=int,
            default=3,
            help="Order book refresh frequency (in seconds, default: 3)")

        parser.add_argument("--debug",
                            dest='debug',
                            action='store_true',
                            help="Enable debug output")

        self.arguments = parser.parse_args(args)
        setup_logging(self.arguments)

        self.bands_config = ReloadableConfig(self.arguments.config)
        self.price_feed = PriceFeedFactory().create_price_feed(self.arguments)
        self.spread_feed = create_spread_feed(self.arguments)
        self.control_feed = create_control_feed(self.arguments)
        self.order_history_reporter = create_order_history_reporter(
            self.arguments)

        self.history = History()

        self.bittrex_api = BittrexApi(
            api_server=self.arguments.bittrex_api_server,
            api_key=self.arguments.bittrex_api_key,
            secret_key=self.arguments.bittrex_secret_key,
            timeout=self.arguments.bittrex_timeout)

        self.order_book_manager = OrderBookManager(
            refresh_frequency=self.arguments.refresh_frequency)
        self.order_book_manager.get_orders_with(
            lambda: self.bittrex_api.get_orders(self.pair()))
        self.order_book_manager.get_balances_with(
            lambda: self.bittrex_api.get_balances())
        self.order_book_manager.cancel_orders_with(
            lambda order: self.bittrex_api.cancel_order(order.order_id))
        self.order_book_manager.enable_history_reporting(
            self.order_history_reporter, self.our_buy_orders,
            self.our_sell_orders)
        self.order_book_manager.start()
コード例 #5
0
# This file is part of Maker Keeper Framework.
#
# Copyright (C) 2017-2018 reverendus
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from pyexchange.bittrex import BittrexApi


bittrex = BittrexApi('https://bittrex.com', 9.5)

print(bittrex.get_all_trades('BTC-ZRX'))
# print(bittrex.get_all_trades('BTC-AAA'))