Quantower
Quantower Website
  • Welcome to Quantower Help
  • 🚀Getting Started
    • What's new
    • Installation
    • First start
    • Platform update
    • Quantower Beta
    • Quantower Account
    • Quantower Licenses
    • ⚖️License Comparison
    • Backup & restore manager
    • Reset settings to default
    • Payment FAQ
    • “Coinpayments” payment
    • Binance fresh account
    • Referral Program
    • You have found a bug. What’s next?
  • ⚙️General Settings
    • Quantower Main Toolbar
    • Workspaces
    • Single Panel
    • Link panels
    • Binds
    • Group of panels
    • Templates
    • Set as Default
    • Symbols lookup
    • Table management
    • Alerts
    • General settings
    • Custom hotkeys
    • Setup Actions & Advanced filters
    • 📢Notifications center
  • 🔗Connections
    • Connections manager
    • Connection to Binance Futures
      • Errors with Binance connection
    • Connection to CQG (AMP Futures)
      • Errors with CQG
    • Connection to OANDA
    • Connection to FXCM
    • Connection to cTrader
      • How to connect to FxPro via Quantower
      • How to connect to Pepperstone via Quantower
      • How to connect to IC Markets via Quantower
    • Connection to Rithmic
      • Rithmic Issues
    • Connection to Topstep
    • Connection to Interactive Brokers
      • Errors with Interactive Brokers
    • Connection to Bybit
    • Connection to OKEx
    • Connection to MetaStock
    • Connection to IQFeed
  • 💡Analytics Panels
    • Chart
      • Chart Overview
      • Chart Types
        • Tick Bars
        • Time aggregation
        • Renko
        • Heiken Ashi
        • Kagi
        • Points & Figures
        • Range bars
        • Line break
        • Volume Bars
        • Reversal Bars
      • Chart Settings
        • View settings
        • Data Style
        • Time Scale
        • Price Scale
        • Visual Trading
          • Positions
        • Order Entry
        • Quick Ruler
        • Info Window
        • Volume Bars
        • Hotkeys
      • Chart overlays
      • Technical indicators
        • Channels
          • Range Marker
          • Donchian Channel
          • High Low Indicator
          • Round Numbers
          • Highest High
          • Lowest Low
          • Bollinger Bands
          • Bollinger Bands Flat
          • Price Channel
          • Fair Value Gap (FVG)
          • Keltner Channel
          • Moving Average Envelope
        • Moving averages
          • Demand Index
          • Exponential Moving Average
          • FYL Indicator
          • Linearly Weighted Moving Average
          • McGinley Dynamic Indicator
          • Modified Moving Average Indicator
          • Pivot Point Moving Average Indicator
          • Regression Line Indicator
          • Simple Moving Average Indicator
          • Smoothed Moving Average Indicator
          • Guppy Multiple Moving Average Indicator
          • Trend Breakout System Indicator
          • Triple Exponential Moving Average Indicator
        • Oscillators
          • Delta Divergence Reversal
          • Aroon Indicator
          • Moving Average Convergence/Divergence
          • Awesome Oscillator
          • Accelerator Oscillator
          • %R Larry Williams
          • Momentum
          • Rate of Change
          • Relative Strength Index (RSI) Indicator
          • Relative Spread Strength (RSS)
          • Balance of Power (BOP)
          • Commodity Channel Index
        • Trend
          • Bionic Candle
          • Average Directional Movement Index (ADX) Indicator
          • Ichimoku Cloud Indicator
          • Directional Movement Index (DMI) Indicator
          • ZigZag
        • Volatility
          • Average True Range
          • Standard deviation
        • Volume
          • COT High/Low
          • Depth of Bid / Ask
          • Delta Flow
          • Delta Rotation
          • Level2 indicator
          • Abnormal Volume
          • Abnormal Trades
          • Volume Impulse
      • Drawing tools
      • Volume Analysis Tools | Volume Profiles | Footprint chart | VWAP
        • Cluster chart
        • Volume profiles
        • Time statistics
        • Time histogram
        • Historical Time & Sales
      • Power Trades
      • VWAP | Volume Weighted Average Price
      • Anchored VWAP
    • Watchlist
    • Time & Sales
    • Price Statistic
    • DOM Surface
    • Option Analytics
    • TPO Profile Chart
  • 💵Trading Panels
    • Chart Trading
    • Crypto Order Entry
    • Multiple Order Entry
    • Order Entry
      • Order entry for Bybit
      • Order Entry for CQG
      • Order Types
      • Order placing strategies
        • Local SL/TP
    • DOM Trader
      • DOM Trader Settings
        • View Settings
        • DOM Trader Columns
        • Order Entry
        • VWAP Settings
        • Positions Bar
        • Hotkeys
      • DOM Trader Columns
      • How to set up Dom for scalping
    • Copy Trading
    • Market depth
    • Trading simulator
    • Market Replay
    • FX Cell
    • Backtest & Optimize
    • Strategies manager
  • 💼Portfolio Panels
    • Positions
    • Working Orders
    • Trades
    • Orders History
    • Synthetic Symbols
    • Historical Symbols
  • 📊Information Panels
    • Account performance
    • Account info
    • Crypto balances
    • Symbol Info
    • Currencies Exposure
    • Event Log
    • RSS (News panel)
    • Reports
  • 📌Miscellaneous
    • Futures Rollover
    • History Exporter
    • Symbol Mapping Manager
    • Sessions manager
    • Live Support
    • Market Heat map
    • Stat matrix
    • Exchange times
    • Quote Board
    • Browser
    • Excel and RTD function
      • Changing RTD Throttle Interval in Excel
    • Quantower Telegram Bot
    • 🎨Themes editor
  • 🤖Quantower Algo
    • Introduction
    • Install for Visual Studio 2022
    • Strategies manager
    • Backtest & Optimize
    • Debugging in VS 2022
    • Simple Indicator
    • Simple strategy
    • Input Parameters
    • Built-In indicators access
    • Custom indicators access
    • Level2 data
    • Access Volume analysis data from indicators
    • Indicator with custom painting (GDI)
    • Access Chart from indicator
    • Using markers with indicators
    • Using Clouds in Indicator
    • Adding a custom indicator to Watchlist
    • Downloading history
    • Access to trading portfolio
    • Trading operations
    • Example: Simple Moving Average
    • Access to crypto account and balances
    • Access to advanced aggregations
    • Access to symbol/account additional fields
    • Strategy runner (deprecated)
  • 💫Customization
    • Localization
  • ⁉️FAQ
    • General Errors
Powered by GitBook
On this page
  • Core - main entry point for all data
  • Connections
  • Accounts
  • Symbols
  • Positions
  • Orders
  • Trades
  • An example of using trading data
  1. Quantower Algo

Access to trading portfolio

Access an info about current opened positions, placed orders or history of your trades

Last updated 6 years ago

Usually, an algorithm of trading strategy requires an access to various trading information for making decisions. It can be your current opened positions, placed orders or history of your trades. Sometimes you may need also detail information about your account or symbol, you are going to trade on. Quantower API provides you full access to all this information and even more. In this topic, we will show how to retrieve it and use in your strategies or indicators

Core - main entry point for all data

object, which is always accessible from your scripts provides you a wide set of different data and functions. You can read full details about this class in our , here we will provide an example of access to the most important and useful data.

You should always remember that Quantower is a trading platform, which provides possibility. From one side - it means you can have access to different connections simultaneously and make really professional strategies, such as arbitraging and others. But from another side, when you need to find required symbol or account you have to specify a little more information than just a name - you should provide a connection id in case you have more than one. Quantower store all data from separate connections in special assigned storages and Core object provide you aggregated data from all your current connections.

Here are the main properties from Core object, that will be enough to create the most of classic strategies:

Connections

Gives you an access to all your connections and possibility to manage them. You can get the current state of , its name, broker/data feed identifier or all data from this particular connection.

Accounts

Provides you an access to all your accounts from all connections. You can search for the required account and retrieve : Name, Balance, Currency, and others.

Don't forget that different brokers may provide you with different information their accounts: from very basic to really full and detailed.

Symbols

Provides you an access to all symbols from all connections. Each has many properties you can use them in your algorithms: Name, LotStep, Description, MinLot, MaxLot, and many others.

Positions

Provides you an access to all positions from all connections. If you need to get positions only from specific connections you can filter them using ConnectionID property, which each position provides among : Quantity, Fee, NetPnl, etc. You can also search for a particular position by its id using GetPositionById method.

Orders

Trades

An example of using trading data

And as usual, let's create a simple example to show possibilities of an API. We will display the main information about your active connections and main objects: accounts, symbols, and positions. It will be quite easy to implement using our explanations above. We need only to iterate through all connections and retrieve the required data. Just, for example, we will use Log function to display this data, but you can use it in any way you need in your scripts. This is source code for our example:

protected override List<StrategyMetric> OnGetMetrics()
{
    //
    // Warning:
    // We placed our code in OnGetMetrics method just for an example
    //

    // Iterate through all connected connections
    foreach (Connection connection in Core.Connections.Connected)
    {
        // Display information about positions                
        foreach (Position pos in Core.Positions)
        {
            // Use positions only from current connection
            if (pos.ConnectionId == connection.Id)
                Log($"PositionID name: {pos.Id},  Position NetPnL: {pos.NetPnL.ToString()}");
        }
        Log($"Positions:", StrategyLoggingLevel.Trading);

        // Display information about accounts                
        foreach (Account account in Core.Accounts)
        {
            // Use accounts only from current connection
            if (account.ConnectionId == connection.Id)
                Log($"Account name: {account.Name},  Account Balance: {account.Balance.ToString()}");
        }
        Log($"Accounts:", StrategyLoggingLevel.Trading);
               
        // Display information about symbols             
        foreach (Symbol symbol in Core.Symbols)
        {
            // Use symbols only from current connection
            if (symbol.ConnectionId == connection.Id)
                Log($"Symbol name: {symbol.Name},  Symbol type: {symbol.SymbolType.ToString()}, Bid: {symbol.Bid}, Ask: {symbol.Ask}");
        }
        Log($"Symbols:", StrategyLoggingLevel.Trading);

        // Display connection name
        Log($"Information from '{connection.Name}' connection:", StrategyLoggingLevel.Error);
    }

    // Standard metrics
    List<StrategyMetric> result = base.OnGetMetrics();            
    return result;            
}

And this is the result of this script displaying in the StrategyRunner Panel.

In this topic, we showed how to get and analyze main trading data - which is always required by strategies. Another important and necessary part of any strategy is trading operations which will be covered in our next article.

Provides you an access to all from all connections. And you also can filter your orders by some connection id if it needed.

Provides you an access to the history of all trades from all connections since login. Each trade contains about its symbol, price, fee, time of execution and others.

This is only the main properties from . You can check our and found many other interesting's ones: Symbol types, Assets, Reports. Actually, you can get all data that are used by Quantower trading platform, as we use the same API during development our plugins.

🤖
Core
API documentation
multi-connection
connection
full information
symbol
other data
orders
information
Core
API documentation
Information about accounts, symbol and positions displayed in StrategyRunner panel