Nav: (Display/Hide) - Home - About the Author / this page

Current Projects: Americana Engine (Game Engine Development)

Friday, August 12, 2016

Robinhood CLI


Five seconds to a buy order

Links: Download (build Aug 25, 2016) - Source Code

Robinhood CLI (rh-cli) - a simple (unofficial) Windows command line client for Robinhood that no one asked for.

Despite being command line, it's more focused on usability than automated trading, and attempts to reduce the time to place a trade to that of other trading platforms, helping to avoid possible price fluctuations in between.

I mainly use this project as a means to get myself into C# programming (making something that works and is something people will use irl) and to learn the more advanced aspects of that language (such as asynchronous programming and parsing json files), but it might be useful to a number of people.

I intend to add features to this program for at least several more months while I'm still looking around for a full-time software development job; feel free to point out any changes made in the backend that prevents this program from working, or any corner cases that I didn't check (such as whether rh positions with > 150 stocks owned will fail to load (either partially or at all), because URI length > 8k ).

Features

This program adds a number of things not seen (afaik) in any other unofficial RH implementation. This list will be added to as time goes on.

  • Increased Realtime Quote Speed - Increased the update time to once per second (this is slightly faster than the update speed on Google Finance), particularly since battery drain is not a real issue on a PC. This is around 5x the speed which Robinhood updates. There might be rate limits, but so far I haven't hit any of them. (If you have a lot of stocks up at one time then updates are slower)
  • Margin Buying Power - Displays how much actual buying power you have in your account in an Instant account. In Robinhood Gold accounts, this also factors in extra buying power based on the tier you have subscribed to, although you will be informed if you cannot use all of it when buying that stock. (A number of assumptions were made on how margin is implemented, so this value may be inaccurate)
  • Maintenance Margin / Initial Margin - Gives you information on how big of a position you can open when extra buying power from RH Gold is considered. (We assume that "extra buying power" represents additional funds handed to you by RH, and are subject to margin requirements). If either of these percents are above 50%, you might not be able to utilize all of your extra buying power on that stock. The official app will adjust your buying power accordingly but will not give you exact margin requirements.
  • Intraday Buying Power (Day Trading Buying Power) - Determines how much you can trade during the day. It's based off of 4x excess margin, so accounts comprised of blue-chip stocks (example) will have substantially higher buying power than those who are mainly holding low-priced and/or volatile stocks (example). On non-PDT accounts, you may start getting High Volatility warnings once you go negative; you will receive a Day Trading Margin Call if you are flagged as a PDT. Buying leveraged ETFs will reduce this faster, so your intraday buying power will be adjusted accordingly. (The app will limit your buying power to prevent this, and does not make any mention of DTBP at all, except in Disclosures.)
  • Max Buy/Sell: Tells you how much of that stock you can buy right now given your buying power, as well as how many shares you have currently and in open orders. (If the price does move past 5% between when you entered the command market orders may not fill). Currently this does not factor the max amount when you place a limit buy order, so be warned if you are planning to spend to the last penny.
  • Stock Split Indicator - If your shares vanished (or were adjusted) because of a reverse stock split, didn't see a notification regarding this (or never got them), and it happened within the last two weeks or so, you will know now. (If you don't have enough shares to meet the reverse split ratio, they are usually converted to cash.) You will also be informed if the opposite holds true.
  • Fees Paid if Applicable - If you are charged a fee when the order is filled, it will inform you. The commission might be zero but the regulatory fees aren't. This fee is more noticeable when selling tens of thousands of dollars worth of shares at once. (FYI: For options, the cost from options regulatory fees alone bumps the total fee to 4 cents a contract, whether you are buying or selling, so make note of that when they support options trading.)
  • Account / Portfolio View - You can display either basic account info and/or a list of all your stocks in your portfolio (including quantity held, equity, cost basis, current price, and profit/loss so far) If your portfolio consists of a lot of stocks it may take a while to load.
  • Extended Hours Trading - Allows you to choose whether your orders will be active during normal market hours or extended hours as well. RH Gold has no setting to toggle this off, so this might be useful in some cases.
  • Additional Warning Messages - Because you are using an unofficial app you may be able to get by some of the restrictions that the official RH app has set in place should those orders fill, so it is my responsibility to cover these scenarios. There is one additional warning if the limit price you are entering is substantially lower than the current price.

    Also, market sell orders executed on this program will not execute if the price would be below 75% of current price (most likely due to significant slippage), at which point you should do a limit sell instead.

Monday, August 1, 2016

Project: Unofficial Robinhood (Web) App Development


When I need more info and a substantial decrease in latency when making trades.*

The lack of non-mobile trading options on Robinhood has led to a large amount of unofficial implementations (most on Github) that allow you to trade while away from a smartphone (other than using an emulator), however a majority of them cover only basic functions to do trading (such as buy/sell stock, get quote information). Seeing an opportunity to enter into the field of web application development, I decide to join in as well, believing I can bring something new to the table.

My first open-source (and real C#) project starting my Github programming portfolio involves use of the console to assist with active trading utilizing the RH API. You still have to manually enter your orders, but it's able to enter positions faster (mainly by skipping the Trade Preview step).

This program was based on other open-sourced apps that used the API; I don't know why most of these implementations have been largely abandoned in recent times, but I guess I'm about to find out.

Github source for the above available here.

Please note: This project exists mostly as a coding portfolio piece; I only have part-time working experience but completing this might get me much closer to getting my foot into the door somewhere.

Progress:

This project is divided into four segments:

  • Robinhood API docs: A forked version of an existing RH API documentation with more endpoints filled out and more focused on consistency.
  • RobinhoodNET: A C# .NET API that allows easy access for most parts of the RH API.
  • rh-cli: command line interface to get various quote information, buy/sell stocks, and a few other things. Stock quotes are updated once per second while placing an order.
  • rh-alt: Alternate* Web Client interface (might be coded with a combination of Angular.JS, Javascript, HTML5 canvas, d3.js, and more)