> ## Documentation Index
> Fetch the complete documentation index at: https://takeprofit.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Package indie.strategies

Package containing trading functionality for creating and managing orders, positions, and commissions in Indie trading strategies.

***

## Types

### `AmendOrderBuilder`

*type*

Builder class for modifying existing trading orders with updated parameters.

**1. Methods**

[Navigate to method\_AmendOrderBuilder\_size](#method_AmendOrderBuilder_size)

size

(size) -> indie.strategies.AmendOrderBuilder

Updates the size (quantity) of the existing order.

**parameters info**

size

float

required

New size for the existing order.

[Navigate to method\_AmendOrderBuilder\_limit](#method_AmendOrderBuilder_limit)

limit

(price) -> indie.strategies.AmendOrderBuilder

Updates the limit price of the existing order.

**parameters info**

price

float

required

New limit price for the existing order.

[Navigate to method\_AmendOrderBuilder\_stop](#method_AmendOrderBuilder_stop)

stop

(price) -> indie.strategies.AmendOrderBuilder

Updates the stop price of the existing order.

**parameters info**

price

float

required

New stop price for the existing order.

[Navigate to method\_AmendOrderBuilder\_take\_profit](#method_AmendOrderBuilder_take_profit)

take\_profit

(stop, \*, limit) -> indie.strategies.AmendOrderBuilder

Updates the take profit settings of the existing order.

**parameters info**

stop

float

required

New stop price for the take profit exit order.

limit

indie.Optional\[float]

default:
None

New limit price for the take profit exit order.

[Navigate to method\_AmendOrderBuilder\_stop\_loss](#method_AmendOrderBuilder_stop_loss)

stop\_loss

(stop, \*, limit) -> indie.strategies.AmendOrderBuilder

Updates the stop loss settings of the existing order.

**parameters info**

stop

float

required

New stop price for the stop loss exit order.

limit

indie.Optional\[float]

default:
None

New limit price for the stop loss exit order.

[Navigate to method\_AmendOrderBuilder\_submit](#method_AmendOrderBuilder_submit)

submit

() -> None

Builds and submits the order updates to the trading system.

***

### `Commission`

*type*

Represents trading commission settings with configurable commission type and value.

**1. Methods**

[Navigate to method\_Commission\_init](#method_Commission_init)

**init**

(value, commission\_type) -> None

Creates a new Commission object with specified value and commission type.

**parameters info**

value

float

required

Numeric value of the commission. For percentage type, should be a decimal (e.g., 0.001 for 0.1%). For fixed type, should be the absolute amount.

commission\_type

indie.strategies.commission\_type

required

Type of commission calculation: `PERCENT` or `FIXED`.

***

### `ExitOrder`

*type*

Represents exit order settings for take profit and stop loss.

**1. Fields**

[Navigate to field\_ExitOrder\_stop](#field_ExitOrder_stop)

stop

float

Stop price for the exit order (take profit or stop loss).

[Navigate to field\_ExitOrder\_limit](#field_ExitOrder_limit)

limit

indie.Optional\[float]

Limit price for the exit order (take profit or stop loss).

***

### `InstrumentInfo`

*type*

Provides read-only information about the traded instrument, such as order size and value limits.

**1. Fields**

[Navigate to field\_InstrumentInfo\_min\_order\_size](#field_InstrumentInfo_min_order_size)

min\_order\_size

float

Minimal order size (quantity) allowed for the instrument.

[Navigate to field\_InstrumentInfo\_min\_order\_value](#field_InstrumentInfo_min_order_value)

min\_order\_value

float

Minimal order value (size multiplied by price) allowed for the instrument.

***

### `Order`

*type*

Represents a trading order with properties for tracking its status, execution type, and parameters.

**1. Fields**

[Navigate to field\_Order\_id](#field_Order_id)

id

str

Unique identifier of the order.

[Navigate to field\_Order\_status](#field_Order_status)

status

indie.strategies.order\_status

Current status of the order.

[Navigate to field\_Order\_execution\_type](#field_Order_execution_type)

execution\_type

indie.strategies.order\_execution\_type

Execution type of the order (market, limit, stop, or stop-limit).

[Navigate to field\_Order\_side](#field_Order_side)

side

indie.strategies.order\_side

Side of the order (buy or sell).

[Navigate to field\_Order\_size](#field_Order_size)

size

float

Size (quantity) of the order.

[Navigate to field\_Order\_limit](#field_Order_limit)

limit

indie.Optional\[float]

Limit price for limit and stop-limit orders. `None` for market and stop orders.

[Navigate to field\_Order\_stop](#field_Order_stop)

stop

indie.Optional\[indie.strategies.Stop]

Stop price for stop and stop-limit orders. `None` for market and limit orders.

[Navigate to field\_Order\_take\_profit](#field_Order_take_profit)

take\_profit

indie.Optional\[indie.strategies.ExitOrder]

Take profit settings for the order. `None` if not set.

[Navigate to field\_Order\_stop\_loss](#field_Order_stop_loss)

stop\_loss

indie.Optional\[indie.strategies.ExitOrder]

Stop loss settings for the order. `None` if not set.

**2. Methods**

[Navigate to method\_Order\_cancel](#method_Order_cancel)

cancel

() -> None

Cancels the order. Equivalent to calling `Trading.cancel_order()` with this order's ID.

[Navigate to method\_Order\_amend](#method_Order_amend)

amend

() -> indie.strategies.AmendOrderBuilder

Returns a builder for amending this order's parameters. Allows modification of size, limit price, and stop price.

***

### `PlaceOrderBuilder`

*type*

Builder class for creating new trading orders with specified parameters.

**1. Methods**

[Navigate to method\_PlaceOrderBuilder\_limit](#method_PlaceOrderBuilder_limit)

limit

(price) -> indie.strategies.PlaceOrderBuilder

Sets the limit price for the order. Applicable to create limit and stop-limit orders.

**parameters info**

price

float

required

Limit price for limit orders. If specified without `stop`, creates a limit order. If specified with `stop`, creates a stop-limit order.

[Navigate to method\_PlaceOrderBuilder\_stop](#method_PlaceOrderBuilder_stop)

stop

(price, direction) -> indie.strategies.PlaceOrderBuilder

Sets the stop price for the order. Applicable to create stop and stop-limit orders.

**parameters info**

price

float

required

Stop price for stop orders. If specified without `limit`, creates a stop order. If specified with `limit`, creates a stop-limit order.

direction

indie.strategies.trigger\_direction

default:
indie.strategies.trigger\_direction.AUTO

Trigger direction for the stop price: `RISES_TO` or `FALLS_TO`, or `AUTO`.

[Navigate to method\_PlaceOrderBuilder\_take\_profit](#method_PlaceOrderBuilder_take_profit)

take\_profit

(stop, \*, limit) -> indie.strategies.PlaceOrderBuilder

Sets the take profit settings for the order.

**parameters info**

stop

float

required

Stop price for the take profit exit order.

limit

indie.Optional\[float]

default:
None

Limit price for the take profit exit order.

[Navigate to method\_PlaceOrderBuilder\_stop\_loss](#method_PlaceOrderBuilder_stop_loss)

stop\_loss

(stop, \*, limit) -> indie.strategies.PlaceOrderBuilder

Sets the stop loss settings for the order.

**parameters info**

stop

float

required

Stop price for the stop loss exit order.

limit

indie.Optional\[float]

default:
None

Limit price for the stop loss exit order.

[Navigate to method\_PlaceOrderBuilder\_submit](#method_PlaceOrderBuilder_submit)

submit

() -> indie.strategies.Order

Builds and submits the new order to the trading system. Returns the created `Order` object.

***

### `Position`

*type*

Represents a current trading position with size and entry price information.

**1. Fields**

[Navigate to field\_Position\_size](#field_Position_size)

size

float

Current position size. Positive for long positions, negative for short positions, zero for no position.

[Navigate to field\_Position\_price](#field_Position_price)

price

float

Average entry price of the current position.

***

### `Stop`

*type*

Represents trigger settings for a stop-order.

**1. Fields**

[Navigate to field\_Stop\_price](#field_Stop_price)

price

float

Trigger price for the stop order.

[Navigate to field\_Stop\_direction](#field_Stop_direction)

direction

indie.strategies.trigger\_direction

The direction in which the market price should go trigger the price of the stop order.

***

### `Trading`

*type*

Main class for executing trading operations including order creation, modification, and cancellation. Provides access to account cash and position information.

**1. Fields**

[Navigate to field\_Trading\_cash](#field_Trading_cash)

cash

float

Available cash balance allocated to the strategy.

[Navigate to field\_Trading\_position](#field_Trading_position)

position

indie.strategies.Position

Current position object containing size and entry price.

[Navigate to field\_Trading\_instrument\_info](#field_Trading_instrument_info)

instrument\_info

indie.strategies.InstrumentInfo

Information about the traded instrument, such as order size and value limits.

**2. Methods**

[Navigate to method\_Trading\_place\_order](#method_Trading_place_order)

place\_order

(side, size) -> indie.strategies.PlaceOrderBuilder

Returns a builder for placing a new trading order with specified side and size.

**parameters info**

side

indie.strategies.order\_side

default:
indie.strategies.order\_side.BUY

Side of the order (buy or sell). Default is `BUY`.

size

float

default:
1.0

Size (quantity) of the order. Default is `1.0`.

[Navigate to method\_Trading\_amend\_order](#method_Trading_amend_order)

amend\_order

(id) -> indie.strategies.AmendOrderBuilder

Returns a builder to amend an existing order's parameters by its ID.

**parameters info**

id

str

required

Unique identifier of the order to update.

[Navigate to method\_Trading\_cancel\_order](#method_Trading_cancel_order)

cancel\_order

(id) -> None

Cancels an existing order by its ID.

**parameters info**

id

str

required

Unique identifier of the order to cancel.

***

## Enums

### `commission_type`

*enum*

Enum representing the type of commission calculation.

**1. Static fields**

[Navigate to const\_commission\_type\_PERCENT](#const_commission_type_PERCENT)

PERCENT

indie.strategies.commission\_type

Commission calculated as a percentage of the trade value (e.g., 0.001 for 0.1%).

[Navigate to const\_commission\_type\_FIXED](#const_commission_type_FIXED)

FIXED

indie.strategies.commission\_type

Commission calculated as a fixed amount per trade (e.g., 0.01 for \$0.01).

***

### `intrabar_order_filter`

*enum*

Enum defining when orders should be executed within a bar during backtesting.

**1. Static fields**

[Navigate to const\_intrabar\_order\_filter\_ON\_BAR\_CLOSE](#const_intrabar_order_filter_ON_BAR_CLOSE)

ON\_BAR\_CLOSE

indie.strategies.intrabar\_order\_filter

Execute orders only at bar close.

[Navigate to const\_intrabar\_order\_filter\_FIRST\_IN\_BAR](#const_intrabar_order_filter_FIRST_IN_BAR)

FIRST\_IN\_BAR

indie.strategies.intrabar\_order\_filter

Execute only the first created order in the bar.

[Navigate to const\_intrabar\_order\_filter\_LAST\_IN\_BAR](#const_intrabar_order_filter_LAST_IN_BAR)

LAST\_IN\_BAR

indie.strategies.intrabar\_order\_filter

Execute only the last created order in the bar.

[Navigate to const\_intrabar\_order\_filter\_NO\_FILTER](#const_intrabar_order_filter_NO_FILTER)

NO\_FILTER

indie.strategies.intrabar\_order\_filter

Execute orders at any time within the bar without filtering.

***

### `market_order_price`

*enum*

Enum defining the price at which market orders are executed in backtesting.

**1. Static fields**

[Navigate to const\_market\_order\_price\_MARKET\_PRICE](#const_market_order_price_MARKET_PRICE)

MARKET\_PRICE

indie.strategies.market\_order\_price

Use the actual market price at the time of execution.

[Navigate to const\_market\_order\_price\_ORDER\_CREATION\_PRICE](#const_market_order_price_ORDER_CREATION_PRICE)

ORDER\_CREATION\_PRICE

indie.strategies.market\_order\_price

Use the price at the moment the order was created.

[Navigate to const\_market\_order\_price\_BAR\_OPEN\_PRICE](#const_market_order_price_BAR_OPEN_PRICE)

BAR\_OPEN\_PRICE

indie.strategies.market\_order\_price

Use the opening price of the bar.

***

### `order_execution_type`

*enum*

Enum representing the execution type of a trading order.

**1. Static fields**

[Navigate to const\_order\_execution\_type\_MARKET](#const_order_execution_type_MARKET)

MARKET

indie.strategies.order\_execution\_type

Market order that executes immediately at the current market price.

[Navigate to const\_order\_execution\_type\_LIMIT](#const_order_execution_type_LIMIT)

LIMIT

indie.strategies.order\_execution\_type

Limit order that executes at a specified price or better.

[Navigate to const\_order\_execution\_type\_STOP](#const_order_execution_type_STOP)

STOP

indie.strategies.order\_execution\_type

Stop order that becomes a market order when the stop price is reached.

[Navigate to const\_order\_execution\_type\_STOP\_LIMIT](#const_order_execution_type_STOP_LIMIT)

STOP\_LIMIT

indie.strategies.order\_execution\_type

Stop-limit order that becomes a limit order when the stop price is reached.

***

### `order_side`

*enum*

Enum representing the side of a trading order.

**1. Static fields**

[Navigate to const\_order\_side\_BUY](#const_order_side_BUY)

BUY

indie.strategies.order\_side

Buy side for a trading order.

[Navigate to const\_order\_side\_SELL](#const_order_side_SELL)

SELL

indie.strategies.order\_side

Sell side for a trading order.

***

### `order_status`

*enum*

Enum representing the current status of a trading order.

**1. Static fields**

[Navigate to const\_order\_status\_CREATED](#const_order_status_CREATED)

CREATED

indie.strategies.order\_status

Order has been created locally but not yet sent to the exchange.

[Navigate to const\_order\_status\_PLACED](#const_order_status_PLACED)

PLACED

indie.strategies.order\_status

Order has been accepted by the exchange and entered the order book.

[Navigate to const\_order\_status\_PENDING\_PLACED](#const_order_status_PENDING_PLACED)

PENDING\_PLACED

indie.strategies.order\_status

Order is waiting for a trigger condition to be met and has not yet entered the order book.

[Navigate to const\_order\_status\_PARTIALLY\_FILLED](#const_order_status_PARTIALLY_FILLED)

PARTIALLY\_FILLED

indie.strategies.order\_status

Order has been partially filled and remains open.

[Navigate to const\_order\_status\_FILLED](#const_order_status_FILLED)

FILLED

indie.strategies.order\_status

Order has been completely filled.

[Navigate to const\_order\_status\_PARTIALLY\_FILLED\_CLOSED](#const_order_status_PARTIALLY_FILLED_CLOSED)

PARTIALLY\_FILLED\_CLOSED

indie.strategies.order\_status

Order has been partially filled and then closed without full execution.

[Navigate to const\_order\_status\_REJECTED](#const_order_status_REJECTED)

REJECTED

indie.strategies.order\_status

Order has been rejected by the exchange.

[Navigate to const\_order\_status\_CANCELED](#const_order_status_CANCELED)

CANCELED

indie.strategies.order\_status

Order has been canceled by the strategy or by the exchange.

***

### `trigger_direction`

*enum*

Enum representing the direction of a stop order trigger.

**1. Static fields**

[Navigate to const\_trigger\_direction\_RISES\_TO](#const_trigger_direction_RISES_TO)

RISES\_TO

indie.strategies.trigger\_direction

Stop order is triggered when the market price rises to or above the stop price.

[Navigate to const\_trigger\_direction\_FALLS\_TO](#const_trigger_direction_FALLS_TO)

FALLS\_TO

indie.strategies.trigger\_direction

Stop order is triggered when the market price falls to or below the stop price.

[Navigate to const\_trigger\_direction\_AUTO](#const_trigger_direction_AUTO)

AUTO

indie.strategies.trigger\_direction

The system automatically determines the trigger direction based on the current market price and specified stop price. If the stop price is above the current market price, it triggers on rise; if below, it triggers on fall.

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.