Overall Statistics
Total Orders
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
0.000%
Drawdown
0.000%
Expectancy
0
Start Equity
100000.00
End Equity
99999.69
Net Profit
0.000%
Sharpe Ratio
-19671.454
Sortino Ratio
-27184.075
Probabilistic Sharpe Ratio
0.068%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-0.027
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
0.427
Tracking Error
0.064
Treynor Ratio
-1262.742
Total Fees
$0.00
Estimated Strategy Capacity
$550000000000.00
Lowest Capacity Asset
EURUSD 8G
Portfolio Turnover
0.00%
# region imports
from AlgorithmImports import *
# endregion

class OandaBrokerageExampleAlgorithm(QCAlgorithm):

    def initialize(self):
        self.set_start_date(2021, 1, 1)
        self.set_cash(100000)

        self.set_brokerage_model(BrokerageName.OANDA_BROKERAGE, AccountType.MARGIN)
        
        self.symbol = self.add_forex("EURUSD", Resolution.MINUTE).symbol

    def on_data(self, data):
        if self.portfolio.invested:
            return
        
        # Place an order with the default order properties  
        ticket = self.limit_order(self.symbol, 1, round(data[self.symbol].price * .9, 5))
        
        # Update the order
        order_fields = UpdateOrderFields()
        order_fields.quantity = 2
        order_fields.limit_price = round(data[self.symbol].price * 1.1, 5)
        order_fields.tag = "Informative order tag"
        response = ticket.update(order_fields)
        if not self.live_mode and response.is_success:
            self.debug('Order updated successfully')