bitraider package¶
Submodules¶
exchange module¶
-
class
bitraider.exchange.CoinbaseExchangeAuth(api_key, secret_key, passphrase)[source]¶ Bases:
requests.auth.AuthBase
-
class
bitraider.exchange.cb_exchange(key=None, secret=None, password=None)[source]¶ Bases:
bitraider.exchange.exchangeCoinbaseExchange API Wrapper
-
get_account_history(account_id)[source]¶ List account activity. Items are paginated and sorted latest first.
-
get_historic_rates(start_time, end_time, granularity, product_id='BTC-USD')[source]¶ Get a historic rates for a product. Rates are returned in grouped buckets based on requested granularity
-
get_holds(account_id)[source]¶ Holds are placed on an account for any active orders. As an order is filled, the hold amount is updated. If ad order is canceled, any remaining hold is removed.
-
-
class
bitraider.exchange.cb_exchange_sim(start_btc, start_usd)[source]¶ Bases:
bitraider.exchange.exchangeClass used for backtesting
-
get_historic_rates(start_time, end_time, granularity, product_id='BTC-USD')[source]¶ Get a historic rates for a product. Rates are returned in grouped buckets based on requested granularity
-
place_order(price, size, side, product_id, historic_timeslice=None)[source]¶ Place an order
For buy orders, we will hold price x size x (1 + fee-percent) USD. For sell orders, we will hold the number of Bitcoin you wish to sell. Actual fees are assessed at time of trade. If you cancel a partially filled or unfilled order, any remaining funds will be released from hold.
-
example_strategy module¶
-
class
bitraider.example_strategy.awesome_strategy(interval=3600, time_from_start=86400, buy_amt=0.001, pivot=0.5)[source]¶ Bases:
bitraider.strategy.strategy
strategy module¶
-
class
bitraider.strategy.strategy(name='default name', interval=5)[source]¶ Bases:
objectstrategy defines an abstract base strategy class. Minimum required to create a strategy is a file with a class which inherits from strategy containing a backtest_strategy function. As a bonus, strategy includes utility functions like calculate_historic_data.
-
static
calculate_historic_data(data, pivot)[source]¶ - Returns average price weighted according to volume, and the number of bitcoins traded
- above and below a price point, called a pivot.
pivot: the price used for returning volume above and below
data: a list of lists formated as follows [time, low, high, open, close]
[
[“2014-11-07 22:19:28.578544+00”, “0.32”, “4.2”, “0.35”, “4.2”, “12.3”],
...]
-
static
trader_template module¶
-
class
bitraider.trader_template.runner[source]¶ Bases:
cmd.Cmd-
load_strategy(module, cls)[source]¶ Load a user-defined strategy from a file.
- module: the filename in the current directory containing the strategy class which
- inherits from bitraider.strategy (does not include .py)
cls: the classname within the file to load
-
strategies= None¶ The currently loaded strategies
-