Home arrow PHP arrow Building an E-mini Trading System Using PHP and Advanced MySQL Queries

Building an E-mini Trading System Using PHP and Advanced MySQL Queries

This article shows illustrative examples of how PHP and some advanced MySQL queries can be used to build an online trading system. For simplicity, we will be featuring one of the most common stock indexes: the S&P 500 index.

TABLE OF CONTENTS:
  1. Building an E-mini Trading System Using PHP and Advanced MySQL Queries
  2. Implementation, steps 1 through 5
  3. Implementation, steps 6 through 13
  4. Implementation, steps 14 and 15
By: Codex-M
Rating: starstarstarstarstar / 4
November 10, 2009

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

This is also called E-mini S&P 500 futures, one of the most commonly traded equities/futures.

The Design

As of September 2009, there was no currently working trading system on the Internet powered by PHP and MySQL despite the platform's popularity among open source communities.

A trading system is used to enter and exit a trade in a stock or futures market. Although in exiting a trade to grab profits and control losses, money management  is a more useful tool than a trading system.

To create a fully working trading system, you need the following processes:

The raw data should be taken from a reputable source for S&P 500 index data. In this article, we will be using Yahoo! Finance data. The export file type is mostly .csv and Excel, so you first need to export the raw data to the MySQL database. (See details below)

The heart of the process is the trading system. It is a method for analyzing raw data and making judgments. Every trader has his or her own trading system to follow, but in this example, we will use the following rules:

Rule 1: Define Delta as the difference between “50 days moving average “and “200 moving average.” If the delta is positive, it indicates a bullish trend, otherwise it's bearish. You can read more about moving averages.

Rule 2: Define % Strength of the trend as Delta/MA 200. This quantifies the strength of the trend. Apply historical data (define limits) for judgment (computation of limits is out of scope for this tutorial). This is more like a trend confirmation.

Use PHP to display the data in HTML tables while using MySQL advance queries (computing average and getting index data) to do some calculations of the moving average.



 
 
>>> More PHP Articles          >>> More By Codex-M
 

blog comments powered by Disqus
   

PHP ARTICLES

- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...
- PHP: Building Concrete Validators
- Sanitizing Input with PHP
- Executing Shell Commands with PHP
- Handling File Data with PHP
- File Security and Resources with PHP
- ArrayObject PHP Class Examples
- ArrayObject PHP Class: An Introduction
- Getting File System Data with PHP
- PHP Tools for Working with the File and Oper...
- Working with the File and Operating System w...
- PHP Proxy Patterns: Completing a Blog


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 10 - Follow our Sitemap

Dev Shed Tutorial Topics: