Making your first request

After you've made record of your API key, you're ready to make your first request! This short guide will tell you more about how the API works and how to get started.

Visual-Programmatic Model

The Stradr API employs a system that allows you to continue using Stradr.com as a normal user in tandem with your programmatic deployments. This means that you can keep investing normally while operating an external system and use them together. This way, you can view the results of your API deployments without having to make command-line queries that count towards the usage limitations of your plan. It also means that you can view statistics about your account from anywhere with an internet connection, not just when directly interacting with your system. Sweet!

Making a request

Now that you understand how the API is structured, you're ready to start investing! Requests can be sent using several different methods, so the rest of this tutorial will use basic HTTP boilerplate that can be replicated using a browser. All parameters are passed using URL queries, which streamlines request processes as they can therefore be passed in any order.

Let's buy 5 shares of Apple. In order to do so, we'll make our request with the following format:

POST https://stradr.com/api/buy?key=YOUR_KEY_HERE&time=now&type=shares&number=5.000

If you've inputted all parameters correctly, we should receive the following response:

{
    status: "success",
    requests: 1
}

Congrats! You've just made your first request. You can verify it's worked by checking the visual interface or querying your positions. Additionally, you'll see that your buying power has decreased in accordance with the price of the order.

Note that all requests count towards your total requests per hour limit and after you've used all permitted requests future requests will be denied for the remainder of the hour. Request quotas are reset every hour, on the hour.

Last updated