Where to begin?

Discussion in 'Automated Trading' started by blackriver, Apr 8, 2023.

  1. Sprout

    Sprout

    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.
     
    #11     Apr 9, 2023
    Humble_R, vanzandt and virtusa like this.
  2. Thank you very much. Do you recommend any of these brokers for simple stock trading in the Dow and NASDAQ?

    Jim
     
    #12     Apr 9, 2023
  3. Thank you, Sprout. :)
     
    #13     Apr 9, 2023
  4. schizo

    schizo

  5. easymon1

    easymon1

    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!
     
    #15     Apr 9, 2023
  6. 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: Apr 9, 2023
    #16     Apr 9, 2023
  7. 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.
     
    #17     Apr 10, 2023
  8. easymon1

    easymon1

    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: Apr 10, 2023
    #18     Apr 10, 2023

  9. Excellent, that’s a great start. Thank you!
     
    #19     Apr 13, 2023
  10. 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.

     
    Last edited: Apr 13, 2023
    #20     Apr 13, 2023