Welcome, Guest |
You have to register before you can post on our site.
|
Online Users |
There are currently 45 online users. » 0 Member(s) | 45 Guest(s)
|
Latest Threads |
Installation
Forum: Getting Started
Last Post: admin
04-20-2023, 08:00 AM
» Replies: 22
» Views: 19,070
|
Strategy allocation with ...
Forum: General Discussion
Last Post: admin
12-24-2022, 12:28 AM
» Replies: 1
» Views: 1,925
|
Adding color to the Portf...
Forum: General Discussion
Last Post: anis
12-20-2022, 02:57 AM
» Replies: 0
» Views: 1,188
|
Stock Signals
Forum: Documentation
Last Post: ds_13
08-08-2022, 01:25 AM
» Replies: 12
» Views: 22,647
|
Troubleshooting and Known...
Forum: Bugs and Problems
Last Post: admin
05-22-2022, 10:38 AM
» Replies: 12
» Views: 14,592
|
Scaling Factor
Forum: General Discussion
Last Post: admin
05-22-2022, 10:36 AM
» Replies: 3
» Views: 3,711
|
Support allocation method...
Forum: General Discussion
Last Post: Marcel
04-21-2022, 04:05 PM
» Replies: 3
» Views: 5,174
|
Check Out our YouTube Cha...
Forum: News
Last Post: MarkeyMark101
04-11-2022, 08:13 AM
» Replies: 1
» Views: 12,816
|
Time stop
Forum: Feature Requests
Last Post: Marcel
03-30-2022, 10:30 AM
» Replies: 2
» Views: 2,591
|
Rounding Shares
Forum: Feature Requests
Last Post: admin
03-21-2022, 06:28 PM
» Replies: 6
» Views: 5,381
|
|
|
Hedging |
Posted by: admin - 08-03-2019, 06:23 PM - Forum: Documentation
- No Replies
|
|
Hedging
As of version 1.1, we have added the ability to hedge a strategy through hedging actions. The idea is that a user can now place an order based on their strategy's long/short exposure, which essentially grants the ability to hedge a strategy with some asset.
Before reading ahead, make sure you have read the Stock Signals tutorial.
Hedging Actions
The two hedging actions are Hedge With Exposure(HWE) and Hedge Against Exposure(HAE), which each act as their name suggests.
Hedging Unit Types
These hedging actions can only be used with some specific hedging unit types, that each behave slightly differently.
Percent of Long Exposure (%LONGEXP) - Open a position based on only the long exposure of your strategy (i.e. sum of the exposure of all your long stocks)
- Note that in this case, HWE means you will be going long, and HAE means you will be going short
Percent of Short Exposure (%SHORTEXP)- Open a position based on only the short exposure of your strategy (i.e. sum of the exposure of all your short stocks)
- Note that in this case, HWE means you will be going short, and HAE means you will be going long
Percent of Net Exposure (%NETEXP)- Open a position based on the net exposure of your strategy (i.e. long exposure - short exposure)
- Note that in this case, HWE and HAE don't necessarily mean you will go long or short (see below for examples)
Percent of Account Long Exposure (%ACCTLONGEXP)- Open a position based on only the long exposure of all your strategies (i.e. sum of the exposure of all your long stocks)
- Note that in this case, HWE means you will be going long, and HAE means you will be going short
Percent of Account Short Exposure (%ACCTSHORTEXP)- Open a position based on only the short exposure of all your strategies (i.e. sum of the exposure of all your short stocks)
- Note that in this case, HWE means you will be going short, and HAE means you will be going long
Percent of Account Net Exposure (%ACCTNETEXP)- Open a position based on the net exposure of all your strategies (i.e. long exposure - short exposure)
- Note that in this case, HWE and HAE don't necessarily mean you will go long or short (see below for examples)
Examples
Each strategy below examines what happens when hedging with different types of portfolios.
Note that hedging actions still support the different order types, time in force, prices, etc. that regular actions support. For the purpose of these examples, we are using simple signals.
Strategy 1 and 2 are basic cases, but please go over them briefly.
We highly recommend you read the examples under Strategy 3, so you can understand exactly how hedging is handled in APM.
Strategy 1
Suppose our current strategy contains the stocks:
AAPL (long $10,000)
IBM (long $5,000)
MSFT (short $4,000)
Now we will look at what happens with various signals:
1) Use SH (Proshares Short ETF) to hedge with our long exposure
We are long $15,000, so we would go LONG $7,500 of SH.
2) Use SH to hedge with our short exposure
We are short $4,000, so we would go SHORT $2,000 of SH
3) Use SH to hedge with our net exposure
Our net exposure is $11,000, so we would go LONG $5,500 of SH
4) Use SPY to hedge against our long exposure
We are long $15,000, so we would go SHORT $7,500 of SPY.
5) Use SPY to hedge against our short exposure
We are short $4,000, so we would go LONG $2000 of SPY
6) Use SPY to hedge against our net exposure
Our net exposure is $11,000, so we would go SHORT $5,500 of SPY
Strategy 2
Suppose our current strategy contains the stocks:
AAPL (long $1,000)
IBM (long $4,000)
MSFT (short $10,000)
1) Use SH to hedge with our net exposure
Our net exposure is -$5,000, so we would go SHORT $2,500 of SH
2) Use SPY to hedge against our net exposure
Our net exposure is -$5,000, so we would go LONG $2,500 of SPY
Strategy 3
Suppose our current strategy contains the same stocks as Strategy 1:
AAPL (long $10,000)
SH (long $5,000)
MSFT (short $4,000)
But now we will use SH to hedge:
1) Use SH to hedge with our short exposure.
Our short exposure is $4,000, so we would go SHORT $400 of SH.
Since we are currently LONG $5,000 of SH, we would SELL $5,400 of SH.
2) Use SH to hedge with our long exposure
Our long exposure is $10,000 without SH, so we would go LONG $1,000 of SH.
However, we are currently LONG $5,000 of SH, so we have to SELL $4,000 of SH.
Why do we exclude SH when calculating long exposure? We assume that we are using SH to hedge against the rest of the portfolio. It wouldn't make sense to include SH in the long exposure calculation since then we would essentially be using SH to hedge against SH.
The same is true for short and net exposure calculations.
Limitations
1) It only makes sense to hedge with one stock in most cases. For example, take the portfolio:
MSFT (long $10,000)
and try hedging with it using SH and TLT:
HWE SH 10 %LONGEXP
HWE TLT 10 %LONGEXP
We process the SH signal first, so we go LONG $1,000 of SH.
Now we process the TLT signal (suppose after the SH order has been executed), but now our long exposure is $11,000, so we would go LONG $1,100 of TLT, which is $100 more than we wanted since we did not want to include SH in the calculation.
Similarly, hedging with multiple stocks using net exposure will also fail since the net exposure calculation will include the other hedges as well.
On the bright side, this issue does not occur when you hedge against long/short exposure. In this case, you are not including the stocks you are using to hedge in the actual long/short exposure calculation.
2) The other limitation is that you cannot hedge for strategies using screeners, since they don't take hedging signals.
|
|
|
File Formats |
Posted by: admin - 07-14-2019, 07:15 PM - Forum: Documentation
- No Replies
|
|
File Formats
The different file formats give you freedom in how you want to create/store signals, and can be set using the File Type field under the Local File, File Screener, Google Drive File and Google Drive Screener signal provider types.
There are three types of file formats: text, json, csv with the following file type extensions: .txt, .json, .csv
Note that all signal files should still have the .sig extension either by itself or followed buy the file type extension. ( i.e. oldstrat.sig, newstrat.sig.txt, newerstrat.sig.csv, lateststrat.sig.json are all valid files names while a file named strat.txt will not be processed).
We recommend using .sig.txt, .sig.csv and .sig.json extensions as they can be identified and thus (pre)viewed easier on mobile devices.
*IMPORTANT*
All files are processed OLDEST to NEWEST by the last modified time. When your strategy requires you to process files in a specific order, make sure the last modified time is set appropriately.
TEXT
The text format is described in the Stock Signals and Stock Screeners threads.
Make sure you have read these threads first in order to understand what makes up a stock signal/screener.
CSV
The csv file is for table formatted signals (comma separated values).
You can specify which columns you want to include (in any order) out of TICKER, ACTION, QUANTITY, UNIT, ORDERTYPE, LIMIT, STOP, TIF, TIFDATE, ID, EXITTARGET, EXITSTOP, REFPRICE, AFTERDATE, ALGO
The only mandatory fields, as with the text format, are TICKER and ACTION. Fields do not need to be capitalized.
You can also include column names that are not one of the above, these columns will simply be ignored.
Notes: - TIFDATE refers to the date specified for the GTD time in force.
- AFTERDATE refers to the trigger time for delayed signals.
Here are some sample csv formatted signal files
TICKER,ACTION,date,comment,QUANTITY,UNIT,ORDERTYPE,LIMIT
AAPL,BTO,20180909,buy apple,,,,
IBM,LONG,20180909,long ibm,100,SHARES,LMT,100
ACTION,TICKER
LONG,APPL
CLOSE,IBM
The following is a specific example for a Custom Target Order (see documenation)
TICKER,ACTION,ORDERTYPE,LIMIT,EXITTARGET
SPY,BTO,LMT,200,500
HPQ,E_TGT,,,400
Notice that you can leave fields you don't need blank. You only need to fill out fields such that the signal is valid.
The csv file format for screeners is very similar, except that only the ACTION and TICKER columns will be read, and the only valid ACTIONS are BUY/SELL (as usual for screeners).
The order of tickers in the screener is from top to bottom, similar to the text format.
ACTION,TICKER,comment
BUY,APPL,
BUY,IBM,Buying IBM today
JSON
The json file format allows for signals to be directly decoded from a json string, and it is only available for signals (and not screeners) as of now.
The file should contain a single JSON object that is a list of JSON formatted signals.
The valid signal fields are: Action, Quantity, Unit, Symbol, TimeInForce, OrderType, LimitPrice, SignalId.
Of these fields, Action and Symbol are mandatory.
Here is a sample json formatted file:
[
{
"Action" : "BTO",
"Symbol" : "AAPL"
},
{
"Action" : "LONG",
"Symbol" : "IBM",
"Quantity" : 100,
"Unit" : "SHARES",
"OrderType" : "LMT",
"LimitPrice" : 100
}
]
|
|
|
Troubleshooting and Known Issues |
Posted by: admin - 11-20-2018, 09:35 PM - Forum: Bugs and Problems
- Replies (12)
|
|
Troubleshooting and Known Issues
This thread will contain a list of known issues regarding APM and the softwares it is integrated with.
Some issues will have easy fixes if you come across them.
APM - After restating your computer or APM, it is possible that APM may tell you that an account is already open, when it is not. Close APM, check your task manager, and close any instances of APM. If that doesn't work, delete the lock.txt file in your account folder.
Interactive Brokers- Market on Close and Limit on Close orders cannot be placed outside of market hours on paper trading accounts.
- Live accounts will work perfectly fine.
- For paper trading accounts, you should either trade during market hours or use Market/Limit orders instead.
- IB usually must be restarted each weekend. There is no known fix, but it is as simple as reopening it and logging back in.
|
|
|
Account Settings |
Posted by: admin - 11-19-2018, 01:39 PM - Forum: Documentation
- No Replies
|
|
Account Settings
The account settings page is where you will manage your broker settings and other account related settings.
Details about setting up your broker are in the startup guide.
Licenses
Refer to the startup guide for details about licenses. When you obtain a license for a real account, you will have to input your license token into the Token field.
Tickers
This section lets you manage the tickers that APM uses at the account level.
Ignore Tickers
You can use this text box to prevent APM from trading a ticker across all strategies. This will allow you to manually trade the ticker yourself without worrying about it affecting your APM strategies.
Orphaned Tickers
This text box will tell you if there are non-ignored tickers that you own (or have orders for) in your portfolio that do not belong to a strategy.
If you want to trade these tickers manually yourself, then you should add them to Ignored Tickers because otherwise any manual orders for them will be automatically cancelled by APM.
If you want to assign some of these tickers to a specific strategy, then simply highlight the ones you want with your mouse and use the buttons above the orphaned tickers text box to transfer them.
If you don't care about what happens to these tickers, then you can leave them and a strategy will be able to take the ticker over and place orders for it.
Note that the orphan tickers text box will only have tickers in it once you connect to your broker.
Email
You have the option to email yourself account information on a schedule that you input.
We suggest you create a new email account that will be used to send the outgoing mail (preferably Gmail). The password you use will be encrypted and stored locally on your computer. The reason we do not use an Alera email to send your data is because we want to preserve the privacy of your data by keeping it off of our own servers.
Once you input this information and set a schedule (refer to the cron guide), you should save the strategy and click the 'play' button beside your schedule to send a test email. If you there is an error with the information you inputted, there will be a message displayed on APM.
Some email services, like Gmail, will not accept automated email messages by default. APM may not be able to detect this issue on its end, so you will have to make sure you modify the settings on your email service to allow this (if you didn't receive the test email). For Gmail, you can find out how to do this here.
Start and Strategies
The Start button will initiate a connection to your broker. If it is successful, the status bar on the bottom of your screen will turn blue.
The Strategies button allows you to view your strategies.
|
|
|
Strategies |
Posted by: admin - 11-18-2018, 09:10 PM - Forum: Documentation
- Replies (4)
|
|
Strategies
You can configure the strategies you want to run in the strategy settings, which is the default page that opens once you've created an account.
Your strategies are listed as tabs at the top of the window, and each individual strategy has 3 tabs: settings, logs and portfolio.
This guide will go over the various sections of the settings tab and then explain what the portfolio and log tabs do.
Before you get started, remember that every time you change a setting, you should click Save, otherwise your settings won't be updated.
Also note that most of the information in this guide can be found directly on APM by hovering over the text boxes.
Strategy
This section is used to configure the where your strategy will get its signals from. Choose a signal provider type from the ones listed and fill out the fields.
There are guides to using the individual signals and screeners that explain the fields in detail.
Strategy Type
This field lets you select the type of asset you will be trading (stocks, crypto, fx) as well as the country and currency the assets are in. Note that you cannot trade assets of two different types in the same strategy, e.g. you cannot trade stocks and fx, nor can you trade UK stocks and USD stocks in the same strategy.
Strategy Priority
Strategy priority allows a strategy to trade tickers from other strategies with lower priority. For example, suppose strategy A has priority 2, strategy B has priority 1, and strategy B is trading AAPL. If strategy A receives a signal for AAPL, then it can "take" AAPL from B and trade it. However, if strategy B then receives a signal for AAPL, it will not be able to trade it since strategy A has higher priority. If two strategies have the same priority, then neither one can trade tickers from the other. Also note that in the account settings there is an Orphan Ticker Priority text box, which lets you set the priority value for orphan tickers. This allow you to manage which strategies can process orphan tickers -- by default orphan ticker priority is 0, so all strategies can process orphan tickers.
To add accommodate different use cases for strategy priority, the signal types CLOSE, BTC, STC will not be able to "take" positions from other strategies and close them. Instead, if you'd like to force this behaviour, you can use signal of the form LONG X 0 SHARES, where X is the ticker name.
Max Number of Positions - non-screener strategies only
This field determines the max number of positions your strategy can hold. There are three ways to cap your positions.
Hard Cap
This option ensures that you cannot place orders if the number of positions + orders is larger than the cap. For example, if your cap is 5 positions, and you have 3 positions in AAPL, IBM, SPY and 2 orders for TLT, GOOG, then you CANNOT place anymore orders in this strategy (unless they are for those 5 tickers)
Hard Cap+
This option functions similar to Hard Cap, except now we don't count CLOSE market orders (MKT/MOC/MOO) towards the number of positions you own. This allows you to "replace" positions by first placing sell market orders and then placing buy orders. Note that by cancelling a CLOSING market orders, the number of positions may go over the cap. In this case, APM will automatically cancel any remaining limit orders.
Hard Cap++
This is the same as Hard Cap+, but we don't count any CLOSE towards the number of positions you own. So, a closing limit order, would be considered to be closing your position even if it may not execute. This feature is mainly intended for crypto traders who may avoid market orders.
Soft Cap
This option only counts your current positions + market (MKT/MOC/MOO) + limit auction (LOO/LOC) orders towards the cap. Then when your cap is full, all remaining orders are automatically cancelled. For example, suppose your cap is 5 and you have 3 positions in AAPL, IBM, SPY, a MKT order to open TLT, three LMT orders to open GOOG, AMZN, V, and a close MKT order for AAPL. Then you are considered to currently have 3 positions in your cap: IBM, SPY, and TLT. We do not count AAPL since there is a market (MKT/MOO/MOC) order closing AAPL. If the LMT orders for GOOG and AMZN are executed, then we will count 5 total positions towards the cap, so the remaining LMT order for V will be cancelled. - If you want to replace existing positions by placing CLOSE market orders for those positions and placing some LMT orders to open new positions, you will have to place the market orders FIRST before you place your new orders in order (otherwise APM won’t think there are free positions available)
- Limit Auction (LOO/LOC) orders are counted towards the cap since they cannot be cancelled at certain times of day (e.g. near market close or open). However, using a CLOSE LOO/LOC order will not free up a position like a market (MKT/MOC/MOO) order since these limit auction orders are not guaranteed to execute.
Soft Cap++
Similar to soft cap, except now any CLOSE order is not counted towards the number of positions you own. Once again, this is mainly intended for crypto traders.
Number of Positions - screener strategies only
This is the number of positions from your screener that APM will hold.
External Program
The purpose of using external programs is to have the ability to run other software to create signals for APM to process.
The guide here goes in detail over how to do this.
Scheduler
The scheduler section allows you to schedule your strategy. Refer to the cron guide to learn how to fill in schedule fields.
There is also a 'play' button to the right of the schedule, which we will call the run button. It will run the strategy immediately instead of waiting for the schedule to trigger, but it will only be enabled when the account is connected and the strategy is not already running.
You also have the option to disable the scheduler for the strategy by unchecking the checkbox beside Enable Scheduler. Everything else will remain the same, except that the strategy won't run.
Position Sizing
This section allows you to allocate how much money you would like to allocate to each strategy and each trade. Refer to the signals guide for details on Unit types.
Strategy Allocation- Choose how much to money to allocate to this strategy, either as total dollar value or a percent of your portfolio
- If you are connected to your broker, then the dollar value associated with your strategy will appear to the left of the text box
Position Sizing Type
There are three types of position sizing types that determine how large position will be- None
- Use the position size provided by the signal provider if it is provided. Otherwise use the Custom Lot Size
- Custom
- Override the position provided by the signal provider and use the Custom Lot Size instead
- We only override if the Unit type is DOLLARS or SHARES because the other types do not need to be overridden
- Scaling
- Scale the position size from the signal provider by a given factor that you specify in the Scaling Factor field.
- We only scale if the Unit type is DOLLARS or SHARES
Custom Lot Size
Allows you to specify the position you want to take if it is not specified by the signal provider or you choose the Custom position sizing type.
The value you specify will be treated as percent of your Strategy Allocation or a dollar amount. Note that if you are connected to your broker, then the current dollar value of the custom lot size will be displayed to the left of the text box.
Very Important!!
Your Strategy Allocation value does not prevent orders from being placed if they will make the strategy exceed its allocation.
This means if you allocate $100,000 to your strategy, and set the Custom Lot Size to 10% (which is $10,000), and the signal provider gives 20 signals, then the strategy will have a total dollar value of $200,000. You should choose your Custom Lot Size based on how many positions you think you will take. You also have the ability to limit the number of positions your strategy will use with the Max Number of Positions field under the Strategy section (where your signal provider settings are). This way if your Custom Lot Size is 10%, you can set the Max Number of Positions to 10 and put a hard limit on the number of positions you take.
Allow Odd Lots
Check this if you want to allow orders/positions of any size to be placed/held.
Otherwise, all orders will be rounded such that the final position held will be a multiple of 100 shares.
Order Types
This section is used to specify the kind of orders you want placed in the market. Refer to the signals guide for details on Order Types.
Default Market Order Type
If no order type is specified by the signal provider, then the order will be a market order. Here you can specify whether you would like to place a Market (MKT) or Market On Close (MOC) order in this case.
This also applies to screeners as well since they use market orders.
Override Market Order Type
This option allows you to override the market order type specified by the signal provider with the Default Market Order Type. This will only override MKT and MOC orders, not LMT or LOC.
Protect Market Orders
This allows the user to 'protect' their market orders by converting them to limit orders as follows:- Buy orders will have a limit price equal to the current bid price PLUS the Protection Offset (as a percent)
- Sell orders will have a limit price equal to the current ask price MINUS the Protection Offset (as a percent)
This prevents buy/sell orders from executing too far away from the current bid/ask price.
This only works for Market orders and not Market on Close orders.
Note that this is broker dependent and the order may not literally be converted to a limit order. For example, in Interactive Brokers, we use SNAP PRIM orders
Override Limit Order Type
This option allows you to override the limit order type specified by the signal provider with your own (keeping the same limit price).
Default Time in Force
If a time in force is not specified by the signal provider, then you can specify a default value. Note that MOC and LOC orders are always going to have DAY time in force.
The time in force specified here will be applied to all screeners as well, but we recommend you use DAY orders.
Email
Email settings related to your strategy
Send Email After Strategy Runs
Check this to send an email after you strategy runs. It will contain data relevant to this specific strategy.
If this check box is disabled, then either your email has not been set up or is disabled in your Account Settings.
Position Management
This section allows you do automatically manage stop loss and target orders for your current positions.
Stop Loss Order Type
Allows you to place stop loss orders with the Stop Loss Percent
Trailing- A trailing stop loss order will trail by the Stop Loss Percent
- An update of the percentage amount will trigger an order update as soon as you save the strategy
Stop- A regular stop loss order will be placed away from the current price by the Stop Loss Percent
- An update of the Stop Loss Percent will not trigger any update on existing orders. It will be used only for all newly placed orders.
A change from regular stop to trailing (or from trailing to stop) will cancel all existing stop loss orders and generate new ones based on the current price.
Generate Target Orders
Allows you to place target profit orders with the Target Profit Percentage.
Note that updating the Target Profit Percentage will not update any existing orders, similar to the stop loss orders.
It is important to note that for both Stop Loss and Target Profit orders, the amount of shares will adjust so the position will be closed if all other regular orders that shrink that position were to be executed at once.
This means if we had a 100 shares of AAPL plus an order to sell 30 shares of AAPL, and we enabled both stop and target orders, we would end up with 3 orders in the market, one to sell 30 shares of AAPL, a stop loss to sell 70, and a target profit to sell 70. Since APM continuously monitors all positions, if the order to sell 30 shares of AAPL gets canceled for any reason at a later time, the quantities for both the stop and target orders will be adjusted to 100 shares automatically by APM.
Order Limits
This section allows you put limits on the number of shares, stock price, or total dollar value (shares x price) of an order.
Minimums
The Min fields specify that an order that does not CLOSE positions will be ignored if it does not meet the min criteria (the exception to this is Min Price, which only applies to non-shrinking orders)
The reason we do not limit close orders is that we need to be able to close positions even if they have a small number of shares.
Maximums
The Max fields specify that an order that does not SHRINK positions will be ignored if it does not meet the criteria.
This is slightly different than Min because we don't apply the limits to close orders and orders that shrink positions.
Why? Because we want you to be able to shrink positions that are very large without having to close them (think about going from long 1000 shares to 100 shares).
We do, however, want the Min conditions to apply to 'shrinking' orders because you may not want to buy/sell one share. For example, processing a signal LONG AAPL everyday may change the number of shares you hold by 1-2 everyday. You can prevent this behavior by setting Min Shares to maybe 10. This feature is not useful for Min Price, so it behaves the same way as the Max fields.
Order Preview and Skip Orders
APM allows you preview the orders that would be placed in the market by clicking the Order Preview button on the bottom left of the settings page.
This feature allows you to semi-automate your system by having the ability to process your signals automatically, review them, and only then place them in the market.
You will notice that in the order preview window, there is a checkbox beside each order that allows you skip the associated ticker or not. Once you click Update Skip Orders List at the bottom of the order preview window, the tickers associated with the orders you selected will be stored in the Skip Orders text box on the bottom right of the strategy page.
Now whenever your strategy runs (for real), it will skip the orders for the tickers in Skip Orders. You can also manually edit skip orders when the strategy is not running.
Log
The log tab mainly logs signals as they are being processed and serves as a way to check that your strategy is running correctly.
Any issues that will cause a signal (or order) to not be processed will appear here. If you notice that some signals have not been processed, check the log to find the reason for having unprocessed signals.
Portfolio
The portfolio tab stores a table of the positions you own and any active orders for the strategy.
You can sort by a specific column by clicking on the column's header.
You can remove a ticker from the strategy by clicking the Remove button on the right. This will not sell the position, it will simply remove it from the strategy so that another strategy can take it.
Trades
The trades tab lists the latest trades for the strategy. The trades go back one or more days depending on the broker API. (e.g. IB reports only the trades since the last closing while the crypto brokers report trades going back weeks)
The partial trades that belong to the same order are aggregated in one entry.
The tickers removed from the strategy (either manually or automatically) will not show in the trades tab.
Order Ref Field (Interactive Brokers)
Each order that is placed by APM in IB has an Order Ref field which is set as the ID of the strategy placing the order. This allows you to keep track of all your trades in each strategy through IB Flex reports. You need to specify "Include Audit Trail Fields" in your Flex Query configuration in order for the Order Ref field to be included in your reports. This solution was originally posted by a user in the following thread: https://aleratrading.com/forum/showthrea...601#pid601
Signal Processing
A ticker can only belong to one strategy at a time. When a strategy processes a signal for a ticker, it needs to check that the ticker does not already belong to a different strategy. If it does belong to a different strategy, then the signal is ignored.
|
|
|
Automating your Self-Contained System |
Posted by: admin - 11-18-2018, 11:41 AM - Forum: Documentation
- Replies (2)
|
|
Automating your Self-Contained System
This guide explains the steps to completely automate data download, signal creation, and signal processing.
The following guides may be helpful:
Requirements:- You have software that can create signals (and download the necessary data) at your disposal
- Enough computer/programming skills to tell your software how to format the signals and where to place them on your computer
Setting up your Program(s)
Make sure you can run any necessary signal generating and data downloading programs as command line executables (that will terminate).
It is not necessary that your software is a command line exe, but it makes it easier to work with in general.
The next thing you want to do is make sure your software can write signals (or a screener) to a file in the format specified in the guides.
The directory that your strategy will read signal files from is located on the bottom right of your screen. Go ahead and modify your software so that it will write files to that directory.
Note that APM can run other programs with command line arguments, meaning that you can take in the file directory as an argument rather than hard-coding it.
Setting up your APM Strategy
We will be using the External Program section of the strategy settings to run your programs. First enable Use External Program.
The File and Arguments fields are used to specify the program you would like to run.
To schedule your program, put a cron string in the Run External Program field (refer to the cron guide).
If there is more than one program you need to run (i.e. one program to download data and one to generate the signals), then you have two options:
- Create a 'dummy' strategy that does nothing except run your second program on a schedule.
- Create a batch file that will run all your programs. This is the more advanced option, so beware of problems such as not waiting for other processes to finish.
For reference, a simple batch file may look like:
"C:/Users/DownloadData.exe"
"C:/Users/GenerateSignals.exe"
Note that if DownloadData.exe is not a command line executable, then the system may not wait for DownloadData.exe to finish before generating signals.
In that case, you will want to try something like:
powershell -Command "Start-Process 'C:/Users/DownloadData.exe' -Wait;Start-Process 'C:/Users/GenerateSignals.exe';"
It is highly recommended that you test that your external program work as expected by manually running them (press the button beside Run External Program) and checking that your signals were generated in the correct folder.
Once you have set up your external program to run, you can set up the other fields in the strategy settings as usual (make sure to use Local File or File Screener as your signal provider).
Then you should check that the signals are correctly processed by pressing Order Preview.
|
|
|
Using Cron for Scheduling |
Posted by: admin - 11-09-2018, 09:13 PM - Forum: Documentation
- Replies (9)
|
|
Cron Scheduling
Scheduling your strategies, email notifications, and external programs in APM can be done using the cron (also crontab) syntax.
Please refer to this guide for another explanation (and some more advanced uses) of the cron syntax used in APM.
You can also find a useful cron converter here.
The cron syntax that APM is slightly different than the classic Unix cron syntax:
* * * * * * *
| | | | | | |
| | | | | | +-- Year (range: 1900-3000)
| | | | | +---- Day of the Week (range: 1-7 or SUN - SAT)
| | | | +------ Month of the Year (range: 1-12)
| | | +-------- Day of the Month (range: 1-31)
| | +---------- Hour (range: 0-23)
| +------------ Minute (range: 0-59)
+-------------- Second (range: 0-59)
Some notes about this format:- The year is optional and does not have to be included
- The week starts on Sunday
- You cannot put a day of the week and a day of the month. Put a ? for one of the options.
- This format includes the second to run at, which is a mandatory field
The idea behind this format is that each cron string is 6 (or 7) numbers (or special characters) that define a schedule.
Special Characters
* : means all possible values. For example, putting * for hours would mean every hour.
? : means no value. This is used for conflicting values, such as putting a number for both the day of month and day of week. One of those values must be ?
- : is used to specify a range of numbers, i.e. 5-7 for hours would mean at 5,6, and 7am.
, : is used to specify a set of numbers, i.e. 5,7 for hours would mean at 5am and at 7am.
Here are some example cron schedules:
* * * ? * * Runs every second
0 * * ? * * Runs every minute
0 30 15 ? * * Runs at 3:30pm every day
0 30 15 ? * MON-FRI Runs at 3:30pm, Monday through Friday
0 30 10,15 ? * MON-FRI Runs at 10:30am and 3:30pm, Monday through Friday
0 10 * ? * * Runs every hour at 10 past the hour
If you are unsure about using cron, we suggest to copy one of the above schedules into APM and modify the second, minute, and/or hour fields to your needs.
Note that APM will tell you the schedule your cron string represents if you hover over the Run Strategy text.
|
|
|
Installation |
Posted by: admin - 11-06-2018, 03:11 PM - Forum: Getting Started
- Replies (22)
|
|
Installation
The Alera Portfolio Manager (APM) can be downloaded (Windows only) from one of the following links.
Also be sure to check out our YouTube Channel
Version 3.3 - PLEASE UNINSTALL AND REINSTALL ALERA IF UPGRADING FROM VERSION 3.3.12 OR LOWER
- version 3.3.30 - Update Yahoo pricing queries
- version 3.3.29 - Fixed minor issue in 3.3.28
- version 3.3.28 - Fixed issue with identifying NASDAQ tickers in IB. This issue was recently introduced by IB.
- version 3.3.26 - Fixed an issue with missing orders introduced in 3.3.25
- version 3.3.25 - Added ability to get margin requirements for symbols in IB through the Alera API
- version 3.3.24 - Yahoo improvements. Signal ID reset requires ID=1 now. Other minor fixes.
- version 3.3.23 - Temporary fix for Yahoo.
- version 3.3.22 - Fixed yahoo price fetching errors. Made application height adjustable.
- version 3.3.21 - Improved system for handling prices, especially when data providers are down. Added option to specify a reference price for market orders using keyword REF_PRICE. See documentation on signals here.
- version 3.3.20 - Also allow CLOSE MKT orders without getting price from Yahoo.
- version 3.3.19 - Fix for historical data in PnL plot. New Gmail integration -- If you are currently using the email feature in APM then you will automatically be prompted to connect your Gmail account upon opening APM.
- version 3.3.18 - Minor Fixes for portfolio view of non-US stocks.
- version 3.3.17 - Binance API Connection Update
- version 3.3.16 - PnL tab improvements/fixes
- version 3.3.15 - Minor improvements: more rounding options, override Time in Force option, save queued conditional orders from being lost upon Broker disconnect.
- version 3.3.14 - Renamed Soft Cap to Soft Cap+ and added new Soft Cap behaviour more similar to Hard Cap
- version 3.3.13 - FIX FOR INTERACTIVE BROKERS. The data source (Yahoo) for plotting PnL broke for March 4, 2022 and caused an error. This is now fixed.
- version 3.3.12 - FIX FOR BINANCE. Binance's API changed and APM was unable to connect anymore. It is fixed in this new version.
- version 3.3.11 - Added ability to specify an IB algo with orders (see documentation). Can now start/stop the account connection through the API
- version 3.3.10 - Added Soft Cap++ and Hard Cap++ for crypto traders (see documentation). Added ability to reload the next valid order ID for every order in IB.
- version 3.3.9- Various minor improvements to API (basic account stats), Binance GTD orders, and APM reconnections. Added ability to close all positions in a strategy.
- version 3.3.8 - Added ability to programmatically start APM and connect to your broker. See documentation.
- version 3.3.7 - Added support for Coinbase Pro
- version 3.3.6 - Minor Improvements, mainly for Binance.
- version 3.3.5 - Upgraded Binance library version.
- version 3.3.4 - Added Delayed Orders. These can be set to trigger after a certain time. See documentation.
- version 3.3.3 - Added ability cancel Custom Stop/Target orders through signals (see documentation). Added BNB as base currency to Binance. Various other minor improvements.
- version 3.3.2 - Fixed issue with handling contract details for invalid tickers in IB (such as corporate actions).
- version 3.3.1 - Added ability to specify to a list of tickers to preload contract details for. See documentation.
- version 3.3.0 - Added Custom Stop/Target orders (see documentation). Various backend improvements.
Version 3.2- version 3.2.8 - Increased allowed precision for trail stop % orders
- version 3.2.7 - Improved rounding for non-margin crypto accounts to improve probability of execution. Other minor improvements.
- version 3.2.6 - APM tries a few more times to reconnect to the broker overnight upon disconnect. Fixed bug with RSN orders being automatically cancelled when no TIF specified
- version 3.2.5 - Removed "simulated trading" warning from Binance test licenses -- very minor change
- version 3.2.4 - Added free Binance licenses since Binance does not offer paper trading. Just select "Free Test License" in your account settings -- note these use REAL money.
- version 3.2.3 - Added ability to place orders outside of Regular Trading Hours in IB. Affects both regular orders and automated STP/TGT orders.
- version 3.2.2 - Added BUSD and USDC as base currencies for Binance. Added support for more LSE tickers in IB.
- version 3.2.1 - Added account level unit types (%ACCTCASH, %ACCTLONGEXP, %ACCTSHORTEXP, %ACCTNETEXP)
- version 3.2.0 - Added support for CFDs (Contracts for Difference). Available for Interactive Brokers users outside of the US and Canada. See APM docs and IB docs
Version 3.1- version 3.1.11 - Fixed display issue in Order Preview for conditional orders
- version 3.1.10 - Fixed issue with Order Preview not correctly processing orders when Hard Cap+ option is used. Slightly adjusted UI layout.
- version 3.1.9 - Added Hard Cap+ option to limit max positions and improved OTL/OTS functionality
- version 3.1.8 - Added OTL/OTS conditional orders and a new column in portfolio tab to display the days in the market for each position.
- version 3.1.7 - Automated Stop/Target orders in IB use the position "cost" provided by IB as the base price now -- this provides more consistent behaviour
- version 3.1.6 - Upgraded IB API backend
- version 3.1.5 - Reworked support for licenses (no noticeable changes on the user end)
- version 3.1.4 - Fixed issue with manually closing positions
- version 3.1.3 - Improved backwards compatibility
- version 3.1.2 - Added ability to view charts for tickers in Trading View
- version 3.1.1 - Added total exposure column to the P&L table
- version 3.1.0 - Added P&L tracking and strategy priority. Documentation coming soon.
Version 3.0- version 3.0.1 - Added default time in force for IBFX and improved logging
- version 3.0.0 - Added FX and Crypto trading for IB and Binance/BinanceUS (see this guide).
Version 2.1- version 2.1.15 - Google drive files are now processed in order of modified time (oldest to newest). Note that Google Drive only stores write time up to the second so your files must be created at least a second apart.
- version 2.1.14 - Added optional expiration time for conditional (RSN/REL/RES) orders. Added STPMKT orders.
- version 2.1.13 - Added Good Until Date (GTD) and Limit if Touched (LIT) orders in IB. Reworked risk manager stop/target orders -- this will treat all your existing stop/target orders as regular orders once you do the update (it will work normally after). Improved soft cap functionality. Added changes to address potential (new) problems with IB API changes -- so we recommend upgrading to this new version of APM.
- version 2.1.12 - Improved Google Drive access speed
- version 2.1.11 - Added support for London Stock Exchange
- version 2.1.10 - Added hard and soft cap for max #stocks (documentation coming soon)
- version 2.1.9 - Added Stop Limit orders
- version 2.1.8 - UI Improvements for Order Preview and Portfolio view
- version 2.1.7 - Portfolio view improvements (added cancel order button) and fixed Google Drive max #positions problem
- version 2.1.6 - Further improvements to logging and formatting
- version 2.1.5 - Slight change to number display/format
- version 2.1.4 - Added ability to run strategies from the API
- version 2.1.3 - Improved Google Drive Support
- version 2.1.2 - Added Google Drive support
- version 2.1.1 - Improved logging
- version 2.1.0 - Added Alera API (see documentation)
Version 2.0- version 2.0.6 - Fixed valid licensing token bug
- version 2.0.5 - Minor pricing fix
- version 2.0.4 - Added re-entry orders
- version 2.0.3 - Added more info to summary emails
- version 2.0.2 - UI Improvements
- version 2.0.1 - Added Australian and Indian Markets
Version 1.1 - not available- version 1.1.4 - Scheduling improvements
- version 1.1.3 - Updated IEX Cloud pricing retrieval
- version 1.1.2 - Updated valid exchanges
- version 1.1.1 - Added Hedging Actions
Version 1.0 - not available- version 1.0.17 - Added csv file format support
Once you install the software, there will be two applications that will run on your computer, the Alera Dashboard and the Alera Portfolio Manager. The Dashboard, for which there will be a shortcut on your desktop, allows you to create/open accounts. Feel free to pin this application to your taskbar for quick access. The APM, which is the core software that will manage your accounts, is opened directly from the Dashboard when you select an account. The APM should not be opened on its own, as it won't allow you to access any accounts you've created. Note that the first time you open the Dashboard and APM, your anti-virus software may scan it. Let it finish its scans and restart the Dashboard if you encounter any problems.
You should also verify that you have .NET Framework version 4.6.2 installed on your computer.
To do so you should open the regedit program, which can found in your windows programs. Go to the path:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full
and verify that the Release's Data value is higher than 394802, as in the example below (in this case the value is 461808).
You can download the latest version of .NET Framework from Microsoft (not .NET Core)
Also make sure that you download the version for running apps (not building apps).
|
|
|
F.A.Q. |
Posted by: admin - 11-06-2018, 02:28 PM - Forum: General Discussion
- No Replies
|
|
Frequently Asked Questions
This thread will contain a list of frequently asked questions that will help users get an understanding of the Alera Portfolio Manager (APM).
Feel free to post other questions you have or think should be added to this list in the comments.
Where do I download the software from?
You can download APM from the installation page.
What Brokers does APM work with?
Currently, the software is only compatible with Interactive Brokers (IB), but we plan to add more brokers in the future.
You will have to open an account with IB in order to use the software.
How do I test APM before using it with real money?
When you open an account with IB, you are given a free paper trading (simulated trading) account that you can use to test APM.
Does it cost money?
The software is free to use for 3 months with a paper trading account (no sign-up required currently).
If you would like to use it with a real account, please email us at contact@aleratrading.com.
What do you do with my account information?
We understand that traders want to keep not only their strategies private, but also their account information.
That is why we designed APM so that no information, other than your account ID (for licensing purposes), is sent to our servers.
What can I trade with APM?
APM currently handles only U.S. stocks. We plan to support options, futures, forex, and crypto.
|
|
|
Stock Screeners |
Posted by: admin - 11-04-2018, 07:21 PM - Forum: Documentation
- Replies (4)
|
|
Stock Screeners
Stock screeners provide a different approach to handling your portfolio. The idea is that you want to evaluate stocks based on certain criteria (ranking) and only hold X stocks in your portfolio based on their rank. To create a stock screener, simply select the File Screener, the Google Drive Screener or the Finviz Screener.
Note that the stock screener only places Market, Market on Close or Market on Open orders, so be aware of the potential issues with such orders. It is possible to prevent some of the issues with the Protect Market Orders field, which is explained in the Strategies Guide.
Number of Stocks
The Number of Stocks field allows you to select how many positions you would like to hold in your portfolio. APM will always try to maintain this number of stocks by taking in consideration the current positions, the sell orders and then filling the open spots. However, if the Number of Stocks is decreased, then APM will not automatically sell stocks at random, it will instead wait for them fall out of the screener (as per the selection mode below).
Selection Mode
The Selection Mode allows you to specify how you would like to process the screener.
Keep Only First - This mode will only hold only the first X stocks in the screener and sell the rest (X is number of stocks you specified in the Number of Stocks field)
Prioritize First- This mode will prioritize the top stocks in the screener. It will only sell stocks if they fall completely out of the screener, rather than out of the top X stocks like the Keep Only First mode.
Dual Screener- This mode allows users to provide a different set of criteria for entering and exiting positions (e.g. enter on an oversold condition and exit on overbought)
- A stock will only be sold if the screener explicitly states it
Creating a Screener File
Similar to regular signal files, a screener file must end have one of the supported extensions (.sig, .sig.txt, .sig.csv) and be placed in the folder specified at the bottom right of the APM.
A screener signal in a .sig.txt file must have the following format:
An example screener file for the modes Keep Only First and Prioritize First would be:
BUY AAPL
BUY SPY
BUY IBM
BUY AA
An example screener file for the Dual Screener mode would be:
BUY APPL
BUY SPY
SELL IBM
SELL AA
Note that SELL actions will be ignored unless the Dual Screener mode is being used.
Web Screeners
Currently, users can create screeners using finviz and process the stocks in that screener with the same modes as the file screener.
Simply copy the URL for the screener you would like to use into the Buy URL field (and the Sell URL field for the Dual Screener).
|
|
|
|