Where to begin?

I hate to tell you this, but if you are unable to figure
out how to choose a book on Amazon, then all of this
programming algorithms and trading automatically
business is NOT for you.

Most serious traders do not have ONE (1) book on
trading, but a shelf full PLUS several ebooks on their
computers, and they read and learn all the time.

There isn't some magic book that tells you all there
is to know about trading, since there are numerous
markets (day trades, options, forex, futures),
systems, methods, etc. and it takes years to learn
about trading.

You need to be a strong decision maker in order to
be successful at trading. Nobody is going to hold
your hand while you choose stocks to invest your
money in.

Trading does not require a big investment, but if
you do not have money that you cannot afford to
lose, again, this is NOT for you.

You are overcomplicating something that you do
not seem to understand.

Start at the beginning, like everybody else.

Engineer-Trading-Screenshot 2023-02-03 080236.jpg


Even so, "Trading Systems and Methods - 6th Ed" by P. Kaufman would be a good place to start.
 
All major brokers offer an API for automating the trading. The API covers account data & operations, market data & operations, order data & operations , and other things like getting lists etc.

Nowadays the JSON data format is often used in such APIs for the data delivery. Ie. you need a JSON-reader-library, or roll your own as it's not that much complicated.

Here for example is the API of YahooFinance (mainly for market data only): https://financeapi.net/
And here the API of TD Ameritrade: https://developer.tdameritrade.com/
And here the APIs of Interactive Brokers: https://www.interactivebrokers.com/en/trading/ib-api.php
...
Thank you very much. Do you recommend any of these brokers for simple stock trading in the Dow and NASDAQ?

Jim
 
students used my simple idea in a class where all of the students competed on an auto trading program assignment. It won the competition by a large margin. So I would like to try it in the stock market and have a small amount of money to use for this experiment. It Is based on the simplest little mathematics axiom.
Given the above it appears that you already have an idea for the method that you want to start with.
What specifically do you lack toward implementing an initial prototype version of your auto trading program?
By the way, Break a Leg!
 
Thank you very much. Do you recommend any of these brokers for simple stock trading in the Dow and NASDAQ?

Jim
I would say all of such APIs can do this, as it's the most basic thing to do via API.

The advantage of the TD Ameritrade API is that it does not need any other program;
it simply uses the standard web-protocol (ie. HTTP/1.1 with encryption, ie. https).
I find this solution easy and flexible, easy to setup and maintain, less work etc.

Of course it will take some time (some weeks/months) to test and get familiar with the API in practice.

Of course there are also further brokers with APIs beyond the 2 or 3 I gave as an example.
Just google for "trading broker API" etc.
 
Last edited:
Given the above it appears that you already have an idea for the method that you want to start with.
What specifically do you lack toward implementing an initial prototype version of your auto trading program?
By the way, Break a Leg!

Easymon1, I lack the knowhow about trading platforms, how to make my algorithm work with them, how to communicate with the stock market for getting archives of data for backtesting, and then for making trades. Probably other stuff too.
 
trading platforms, how to make my algorithm work with them
Put in a little time on a search engine session and you'll be cooking in no time.

search term: Trading platforms, how to make my algorithm work with them
https://www.dogpile.com/serp?q=trading+platforms%2C+how+to+make+my+algorithm+work+with+them

How to make my trading algorithm work with Interactive Brokers (etc)
https://www.dogpile.com/serp?q=How+to+make+my+trading+algorithm+work+with+interactive+brokers

Interactive Brokers API
https://www.dogpile.com/serp?q=Interactive+Brokers+API

Key Features:
IBKR's proprietary, open-source API
Place orders, view trades and positions, access market data, news and account data
Connect through our proprietary Trader Workstation or IB Gateway platform
Develop applications in C++, C#, Java, Python, ActiveX, RTD or DDE
Available via leased line, cross-connect or internet

TD Ameritrade API
https://www.dogpile.com/serp?q=TD+Ameritrade+API
 
Last edited:
Put in a little time on a search engine session and you'll be cooking in no time.

search term: Trading platforms, how to make my algorithm work with them
https://www.dogpile.com/serp?q=trading+platforms%2C+how+to+make+my+algorithm+work+with+them

How to make my trading algorithm work with Interactive Brokers (etc)
https://www.dogpile.com/serp?q=How+to+make+my+trading+algorithm+work+with+interactive+brokers

Interactive Brokers API
https://www.dogpile.com/serp?q=Interactive+Brokers+API

Key Features:
IBKR's proprietary, open-source API
Place orders, view trades and positions, access market data, news and account data
Connect through our proprietary Trader Workstation or IB Gateway platform
Develop applications in C++, C#, Java, Python, ActiveX, RTD or DDE
Available via leased line, cross-connect or internet

TD Ameritrade API
https://www.dogpile.com/serp?q=TD+Ameritrade+API


Excellent, that’s a great start. Thank you!
 
The Hamilton-Jacobi-Bellman (HJB) equation is a partial differential equation that arises in the field of optimal control theory. It is used to find the optimal control actions for a given dynamic system by minimizing a certain cost or maximizing a certain reward. The HJB equation represents the value function

V(t, x) = min_u { L(t, x, u) + ∂V(t, x)/∂t + ∇V(t, x) • f(t, x, u) }

where:

V(t, x) is the value function, which represents the expected cost or reward at time t and state x.
u represents the control variable or action (e.g., buying or selling stocks).
L(t, x, u) is the running cost or instantaneous reward associated with a given state x, control action u, and time t.
∂V(t, x)/∂t is the partial derivative of the value function with respect to time.
∇V(t, x) is the gradient of the value function with respect to the state variables x.
f(t, x, u) represents the dynamics of the system, describing how the state variables x evolve over time given the control actions u.
The "min" operator indicates that the goal is to minimize the total cost or maximize the total reward.

The HJB equation can be potentially applied to improve one's ability to trade stocks profitably and consistently by formulating the stock trading problem as an optimal control problem. Here, the objective is to maximize the expected profit over time while considering transaction costs, taxes, and other factors that might affect the overall profitability.

To apply the HJB equation to stock trading, one needs to:

  1. Define the state variables: These can include stock prices, cash balance, stock holdings, and other relevant market information.
  2. Define the control variables: These are the actions that the trader can take, such as buying, selling, or holding stocks.
  3. Define the dynamics: This includes modeling how the state variables evolve over time, taking into account market factors and the trader's control actions.
  4. Define the objective function: This is the expected profit or reward that the trader aims to maximize over time, considering factors such as transaction costs, taxes, and risk.

Once the problem is formulated, the HJB equation can be used to find the optimal trading strategy. By solving the HJB equation, one can obtain the value function and the corresponding optimal control policy. This policy dictates the best action to take at any given time, given the current state of the market and the trader's holdings.

However, it is important to note that applying the HJB equation to real-world stock trading is challenging due to several factors:

  1. High-dimensional state space: The state variables in stock trading problems can be numerous and continuous, leading to a complex and high-dimensional state space.
  2. Uncertainty and non-stationarity: Stock prices and market conditions are often affected by unpredictable events, making the problem non-stationary and difficult to model accurately.
  3. Computational complexity: Solving the HJB equation, especially for high-dimensional problems, can be computationally intensive and may require advanced numerical techniques.
Despite these challenges, applying the HJB equation and optimal control theory to stock trading can provide valuable insights into developing profitable and consistent trading strategies. It may also help traders better understand the factors affecting their performance and make more informed decisions in the market.

I have some programming background, and I'd like to try writing a program or algorithm to automatically trade stocks. I need to learn the mechanics of how this can be done. I need access to stock market data, and learn how people connect to the market to do the trading. Hopefully there are approaches that don't require a big investment to start experimenting.

Is there a book, website, or other source you would refer me to to start learing? I see several books on Amazon but it would be good if one of them has a good reputation or is a favorite among experienced people here.

Thanks much,
Jim
 
Last edited:
Back
Top