Skip to content

Commit

Permalink
docs: updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
kieran-mackle committed Mar 9, 2024
1 parent 1eb06b5 commit 08665c2
Show file tree
Hide file tree
Showing 16 changed files with 279 additions and 422 deletions.
17 changes: 0 additions & 17 deletions docs/source/broker/broker-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Orders, Trades and Positions <trading>
Virtual Broker <virtual-broker>
Oanda <oanda>
Interactive Brokers <ib>
dYdX <dydx>
CCXT <ccxt>
```

Expand Down Expand Up @@ -62,14 +61,6 @@ instance. This allows you to access all methods offered by an exchange,
outside of the unified methods listed in the table above.


## Accessing the Broker Instance
To access the broker instance from your strategy, set `INCLUDE_BROKER` to
True in your [strategy configuration](strategy-config). Doing so, the
broker instance and broker utilities will be passed as named arguments
`broker` and `broker_utils` to your strategy's `__init__` method.



## Module Structure
Each new broker API is contained within its own submodule of the
`autotrader.brokers` module. This submodule must contain two more
Expand Down Expand Up @@ -117,14 +108,6 @@ As of AutoTrader `v0.6.0`, [Interactive Brokers](ib-module-docs) is also
supported.


### DYDX Cryto Exchange

`broker='dydx'`

[dYdX](https://dydx.exchange/) is a decentralised cryptocurrency derivatives
exchange.


### CCXT

`broker='ccxt:<exchange name>'`
Expand Down
2 changes: 1 addition & 1 deletion docs/source/broker/ccxt.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ CCXT:EXCHANGE:
## API Reference
```{eval-rst}
.. autoclass:: autotrader.brokers.ccxt.broker.Broker
.. autoclass:: autotrader.brokers.ccxt.Broker
:members:
:private-members:
```
47 changes: 0 additions & 47 deletions docs/source/broker/dydx.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/source/broker/ib.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

## API Reference
```{eval-rst}
.. autoclass:: autotrader.brokers.ib.broker.Broker
.. autoclass:: autotrader.brokers.ib.Broker
:members:
:private-members:
```
4 changes: 1 addition & 3 deletions docs/source/broker/oanda.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
`broker='oanda'`



## Supported Features

| Feature | Supported? | Alternative |
Expand Down Expand Up @@ -42,11 +41,10 @@ OANDA:
````



## API Reference

```{eval-rst}
.. autoclass:: autotrader.brokers.oanda.broker.Broker
.. autoclass:: autotrader.brokers.oanda.Broker
:members:
:private-members:
```
Expand Down
11 changes: 6 additions & 5 deletions docs/source/broker/trading.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,12 @@ need not be. Read more about stop-limit orders
[here](https://www.investopedia.com/terms/s/stop-limitorder.asp).

```python
stop_limit_order = Order(direction=1, order_type='stop-limit',
order_limit_price=1.2312, order_stop_price=1.2300)
stop_limit_order = Order(
direction=1,
order_type='stop-limit',
order_limit_price=1.2312,
order_stop_price=1.2300
)
```


Expand Down Expand Up @@ -132,7 +136,6 @@ are treated as `market` order type (liquidity consuming) when calculating tradin
```



(isolated-position-object)=
## Isolated Positions
```{eval-rst}
Expand All @@ -141,8 +144,6 @@ are treated as `market` order type (liquidity consuming) when calculating tradin
```




(position-object)=
## Positions
```{eval-rst}
Expand Down
2 changes: 1 addition & 1 deletion docs/source/broker/virtual-broker.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ and used to simulate execution.
## API Reference

```{eval-rst}
.. autoclass:: autotrader.brokers.virtual.broker.Broker
.. autoclass:: autotrader.brokers.virtual.Broker
:members:
:private-members:
```
89 changes: 0 additions & 89 deletions docs/source/core/AutoData.md

This file was deleted.

5 changes: 1 addition & 4 deletions docs/source/core/core-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
:hidden:
AutoTrader <AutoTrader>
AutoData <AutoData>
AutoPlot <AutoPlot>
AutoBot <AutoBot>
Utilities <utilities>
Expand All @@ -23,7 +22,6 @@ The table below provides a summary of the modules available.
| Module | Description |
| :----: | ----------- |
| [AutoTrader](autotrader-docs) | The primary API, used for all trading purposes. |
| [AutoData](autodata-docs) | The data retrieval API, used by AutoTrader and for manual use. |
| [AutoPlot](autoplot-docs) | The automated plotting tool, used by AutoTrader and for manual use. |
| [AutoBot](autobot-docs) | A trading bot, used to manage data and run strategies. |
| [Utilities](utilities-module) | A collection of tools and utilities to make everything work. |
Expand Down Expand Up @@ -60,8 +58,7 @@ watchlist. There is a second configuration file, the [global configuration](glob
conditionally. If you are live trading, you will need to create a global configuration
file to provide brokerage account details. You will also need to do this if you wish to use a broker to obtain price data.
If you will are only backtesting, you do not need
to provide a global configuration file. In this case, [AutoData](autodata-docs) will revert to using the Yahoo Finance
API for price data.
to provide a global configuration file.


### AutoTrader
Expand Down
12 changes: 1 addition & 11 deletions docs/source/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This page has all the information required to download and install AutoTrader.

AutoTrader can be installed in two ways; through
[PyPI](https://pypi.org/project/autotrader/) or by cloning the repository
directly.
directly.


### PyPI Install
Expand Down Expand Up @@ -46,7 +46,6 @@ optionally install more dependencies, depending on where you plan to trade or wh
data from.

Options include:
- dydx: to include dYdX dependencies
- ccxt: to include CCXT dependencies
- oanda: : to include Oanda v20 dependencies
- ib: to include Interactive Broker dependencies
Expand All @@ -59,15 +58,6 @@ example:
pip install autotrader[ccxt,yfinance]
```

### A note on dYdX Dependency
The package dependencies of the
[dYdX V3 Python interface](https://pypi.org/project/dydx-v3-python/) are
very tightly defined. For example, if you try to install AutoTrader with
both the `ccxt` and `dydx` dependencies, pip will not be able to resolve
the conflicts. As such, it is recommended that you maintain separate
environments for your trading.


## Demo Repository
To make getting started with AutoTrader even easier, download the demo repository from
[here](https://github.com/kieran-mackle/autotrader-demo). This repo contains example run files, strategies and configuration
Expand Down
12 changes: 6 additions & 6 deletions docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ to offer. Otherwise, head on over to the


## Supported Brokers and Exchanges
With AutoTrader `v0.7.0`, you can access over 100 cryptocurrency exchanges thanks to the integration
of [CCXT](https://github.com/ccxt/ccxt). The table below summarises the connection to supported brokers.
AutoTrader supports integrations with the following brokers.

| Broker | Asset classes | Integration status | Docs page |
| -------- | ------------- | ------------------ | --------- |
| [Oanda](https://www.oanda.com/) | Forex CFDs | Complete | [link](oanda-module-docs)|
| [CCXT](https://github.com/ccxt/ccxt) | Cryptocurrencies | Complete | [link](ccxt-module-docs) |
| [Interactive Brokers](https://www.interactivebrokers.com/en/home.php) | Many | In progress | [link](ib-module-docs) |
| [dYdX](https://dydx.exchange/) | Cryptocurrencies | Complete | [link](dydx-module-docs) |
| [CCXT](https://github.com/ccxt/ccxt) | Cryptocurrencies | In progress | [link](ccxt-module-docs) |
<!-- | [dYdX](https://dydx.exchange/) | Cryptocurrencies | Complete | [link](dydx-module-docs) | -->


## Latest Changes
AutoTrader `v0.7.0` has been released! Make sure to check out the [changelog](changelog) when upgrading
AutoTrader has gone through a full refactor to simplify the way things run.
Make sure to check out the [changelog](changelog) when upgrading
for details on the breaking changes and latest features.

## Index
Expand All @@ -60,7 +60,7 @@ Feature Showcase <features/features>
```

```{toctree}
:maxdepth: 2
:maxdepth: 1
:caption: Using AutoTrader
:hidden:
Expand Down
17 changes: 2 additions & 15 deletions docs/source/tutorials/building-strategy.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ NAME: 'Simple Macd Strategy' # strategy name
MODULE: 'macd' # strategy module
CLASS: 'SimpleMACD' # strategy class
INTERVAL: '1h' # stategy timeframe
PERIOD: 300 # candles required by strategy
SIZING: 'risk' # sizing method
RISK_PC: 1.5 # risk per trade (%)
PARAMETERS: # strategy parameters
ema_period: 200
MACD_fast: 12
Expand All @@ -78,19 +75,9 @@ alone, as specified by the `WATCHLIST` key. Note that the format
of the instruments provided here must match your data feed (in this case,
Yahoo Finance, which denotes FX with '=X').

It is worth noting that we are taking advantage of AutoTrader's automatic
position size calculation, by defining the `SIZING: 'risk'` and `RISK_PC: 1.5`
keys. These keys tell AutoTrader to use a risk-based approach to position
sizing. As such, when an order is submitted from the strategy, AutoTrader
will use the current price and stop-loss price to calculate the appropriate
position size, capping the maximium loss to the percentage defined by
`RISK_PC`. In this case, any single trade can only ever lose 1.5% of the
account.

We also define the `INTERVAL: '1h'` key, meaning that our strategy will run
on the 1-hour timeframe. This value is used when retrieving price data
through [AutoData](autodata-docs). This is discussed more in the next
section.
on the 1-hour timeframe. This value is used when retrieving price data.
This is discussed more in the next section.
```{tip}
You can find a template strategy configuration file in the
Expand Down
Loading

0 comments on commit 08665c2

Please sign in to comment.