By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
SmartData CollectiveSmartData Collective
  • Analytics
    AnalyticsShow More
    data Analytics instagram stories
    Data Analytics Helps Marketers Make the Most of Instagram Stories
    15 Min Read
    analyst,women,looking,at,kpi,data,on,computer,screen
    What to Know Before Recruiting an Analyst to Handle Company Data
    6 Min Read
    AI analytics
    AI-Based Analytics Are Changing the Future of Credit Cards
    6 Min Read
    data overload showing data analytics
    How Does Next-Gen SIEM Prevent Data Overload For Security Analysts?
    8 Min Read
    hire a marketing agency with a background in data analytics
    5 Reasons to Hire a Marketing Agency that Knows Data Analytics
    7 Min Read
  • Big Data
  • BI
  • Exclusive
  • IT
  • Marketing
  • Software
Search
© 2008-23 SmartData Collective. All Rights Reserved.
Reading: Trading System Description
Share
Notification Show More
Aa
SmartData CollectiveSmartData Collective
Aa
Search
  • About
  • Help
  • Privacy
Follow US
© 2008-23 SmartData Collective. All Rights Reserved.
SmartData Collective > Analytics > Predictive Analytics > Trading System Description
Predictive Analytics

Trading System Description

Editor SDC
Last updated: 2009/03/01 at 11:03 PM
Editor SDC
6 Min Read
SHARE

In the next two weeks, IB’s Collegiate Olympiad starts. The following describes the system I’m entering. I previously mentioned that it uses TWS’s ActiveX API to connect to IB through Matlab and listed some other info not covered below. Links to all the Matlab files are at the bottom of this post.

System Process Flow
1. Load Data – modules for Yahoo and IB
2. Preprocess
3. Prediction Engine
4. Position Sizing
5. Execution
+ Backtest

Process Flow Description
1. Historical data, including the most recent period is downloaded from Interactive Brokers.
2. OHLC numbers are converted into periodic returns, and the put in the proper ordering, newest to oldest.
3. Support vector regression with a Gaussian kernel, using parameters (C, γ) chosen by sliding window validation, is used to predict the next period’s return for each security/contract. These predictions are normalized and weighted by a confidence value. (code outline below)
4. (manual for now)
5. Send the basket of orders to IB through the TWS ActiveX API
+ Backtesting is relatively efficient because most validation folds are redundant

Prediction Engine Code Outline

Initialize parameters
Pre-allocate array mem...

More Read

predictive analytics for amazon pricing

Using Predictive Analytics to Get the Best Deals on Amazon

Predictive Analytics Helps New Dropshipping Businesses Thrive
Promising Benefits of Predictive Analytics in Asset Management
Albanian Bitcoin Investors Tap the Power of Predictive Analytics
Predictive Analytics Improves Trading Decisions as Euro Rebounds


In the next two weeks, IB’s Collegiate Olympiad starts. The following describes the system I’m entering. I previously mentioned that it uses TWS’s ActiveX API to connect to IB through Matlab and listed some other info not covered below. Links to all the Matlab files are at the bottom of this post.

System Process Flow
1. Load Data – modules for Yahoo and IB
2. Preprocess
3. Prediction Engine
4. Position Sizing
5. Execution
+ Backtest

Process Flow Description
1. Historical data, including the most recent period is downloaded from Interactive Brokers.
2. OHLC numbers are converted into periodic returns, and the put in the proper ordering, newest to oldest.
3. Support vector regression with a Gaussian kernel, using parameters (C, γ) chosen by sliding window validation, is used to predict the next period’s return for each security/contract. These predictions are normalized and weighted by a confidence value. (code outline below)
4. (manual for now)
5. Send the basket of orders to IB through the TWS ActiveX API
+ Backtesting is relatively efficient because most validation folds are redundant

Prediction Engine Code Outline

Initialize parameters
Pre-allocate array memory
Data error checking and preprocessing

For each contract (i.e. security)
For each parameter permutation (C, γ)
For each validation fold
Train the SVM on the training sample
Make test prediction and compare to known test sample
Save all processing-time and prediction data
End
Calculate validation performance of (C, γ)
End
Chart results for human inspection
Predict the next period’s returns
End

Confidence based on validation accuracy: correlation
Choose out- & under-performers based on prediction z-scores*confidence

Final Words
The schematic sketch turned out to be too wordy so I used this format instead. All of the information above is mirrored in the system’s code, and is intended to be used as a reader’s guide. Without this, I doubt the code’s comprehensibility. Some parts are simply very complex and may be hard to conceptualize not having been the original inventor, ex. the 6-D array ‘storTestPred’. If you are especially interested in a certain part, such as the sliding window validation or confidence values, please leave a comment or send me an email and I explain in more detail, maybe posting a video if it would be clearer. If you want to do a test run with yahoo data, download all the files to Matlab’s current directory and then execute sys2.m and predictionengine.m. Make sure you have no variables lying around by restarting Matlab or typing >> clear. Both are scripts so you can just do it like this at the Matlab prompt: >> sys2 [press enter, then wait a few seconds], >> predictionengine [press enter, then wait a minute or two]. Some numbers and charts will pop up at the end- you need to understand the code in order to understand these results.

I’m not worried about the system’s strategy being “arbed away” by sharing because of its generality and flexibility. Also it’s probably challenging to understand the code if you didn’t spend many hours writing it. And generally, I don’t subscribe to the secretiveness of the trading subculture. I hope bits are useful. Much can be pared away to create a general system framework. The validation and data pulling components should be especially useful for that. Actually, I may gut some of the internals and make a template that’s a little more fun and easy to play with later. Feel free to comment on anything.

Files: loaddata.m makeportfolio.m predictionengine.m preprocess.m svmpredict.mexw32 svmtrain.mexw32 sys2.m libsvm-mat-2.87-1.zip, or LIBSVM from the authors’ website– using the first one on the list of “Interfaces to LIBSVM”. My version of LIBSVM was slightly modified by me to suppress some useless output that was slowing down validation so I don’t know if the author’s version will work exactly the same- but it should. Here’s everything in one zip file if you are ok with potentially virus-infested zip files (personally I don’t trust them)

Editor SDC March 1, 2009
Share This Article
Facebook Twitter Pinterest LinkedIn
Share

Follow us on Facebook

Latest News

ai low code frameworks
AI Can Help Accelerate Development with Low-Code Frameworks
Artificial Intelligence
data Analytics instagram stories
Data Analytics Helps Marketers Make the Most of Instagram Stories
Analytics
data breaches
How Hospital Security Breaches Devastate Local Communities
Policy and Governance
analyst,women,looking,at,kpi,data,on,computer,screen
What to Know Before Recruiting an Analyst to Handle Company Data
Analytics

Stay Connected

1.2k Followers Like
33.7k Followers Follow
222 Followers Pin

You Might also Like

predictive analytics for amazon pricing
Predictive Analytics

Using Predictive Analytics to Get the Best Deals on Amazon

8 Min Read
predictive analytics in dropshipping
Predictive Analytics

Predictive Analytics Helps New Dropshipping Businesses Thrive

12 Min Read
analyst,women,looking,at,kpi,data,on,computer,screen
Predictive Analytics

Promising Benefits of Predictive Analytics in Asset Management

11 Min Read
predictive analytics helps Albanian bitcoin investors
Blockchain

Albanian Bitcoin Investors Tap the Power of Predictive Analytics

9 Min Read

SmartData Collective is one of the largest & trusted community covering technical content about Big Data, BI, Cloud, Analytics, Artificial Intelligence, IoT & more.

giveaway chatbots
How To Get An Award Winning Giveaway Bot
Big Data Chatbots Exclusive
data-driven web design
5 Great Tips for Using Data Analytics for Website UX
Big Data

Quick Link

  • About
  • Contact
  • Privacy
Follow US
© 2008-23 SmartData Collective. All Rights Reserved.
Go to mobile version
Welcome Back!

Sign in to your account

Lost your password?