Experimental Bars prediction API

Hello everyone!

I created a new type of machine learning based on what could be best described as a biosynthetic model.

That aside I created an API anyone can use (of course their paper id and secret… don’t give me the live stuff :)).

Here goes… all calls are GET so can be executed from a web browser, postman, or even a spreadsheet. It runs on a very small server with limited capabilities so more like a proof of concept but at least it could wriggle some correlation.

Endpoint is:

https://api.berrye.com

To start a prediction run the following below which is pretty self explanatory:

ENDPOINT/security?payload={“id”:"…",“secret”:"…",“commodity”:“TRIL”,“window”:500,“rate”:“day”}

Returns a token: {“token”:"…"}

window is how many units of rate from now you look in the past to infer the next bar. Capped at 500 per Alpaca API.

“rate” is: minute or 1Min, 5Min, 15Min, day or 1D

If it can’t get data it will give out an error.

The token used can be used to query for a prediction. You have to make a query at least once every 3 minutes or the prediction process dies.

ENDPOINT/prediction?payload={“token”:"…"}

which returns a JSON object of the format:

{“result”:[[{“cycle”:…,“error”:…,“id”:"…",“result”:[13.08],“token”:"…"},{“cycle”:…,“error”:…,“id”:"…",“result”:[12.38],“token”:"…"}]]}

Basically an array of 2 sub-objects giving you an upper and lower band to expect next from the previous bars. Here high is 13.08 and low is 12.38.

error is the quadratic sum of all the errors between the computed predictions and the backtesting.

The run will automatically stop after a while, or if not queried within 3 minutes, or explicitly stopped using:

ENDPOINT/stop?payload={“token”:"…"}

Thats’ it… feedback welcome! Eager to know if this works at all.

Did an update to allow for multiple securities to be analyzed by specifying an array of at least one value:

ENDPOINT/security?payload={“id”:"…",“secret”:"…",“commodities”:[“TSLA”,“NKLA”,“TRIL”],“window”:500,“rate”:“day”}

Results now also give out an array of values e.g

{
“result”: [{
“TSLA”: [
[{
“cycle”: 152,
“error”: 722061.3501217194,
“id”: “f0a2ee4d-fc86-4cca-a738-5a9e1db7ddc0”,
“result”: [842.41],
“token”: “0abac847-3256-4ba1-83ad-0cad684ae755”
}, {
“cycle”: 139,
“error”: 1479543.2038127007,
“id”: “399ed6c5-fc4e-405e-abae-05c94c7aab9f”,
“result”: [858.66],
“token”: “f6405966-8413-44bd-a02e-93405fdabc7a”
}]
]
}, {
“NKLA”: [
[{
“cycle”: 143,
“error”: 1689.0712348374398,
“id”: “cb929c50-138e-43d1-98af-ccf73d4a4bae”,
“result”: [24.431731194690265],
“token”: “baa86ed3-5ca7-40a1-91c8-bbf13d0ffae3”
}, {
“cycle”: 164,
“error”: 1422.7468335071512,
“id”: “aa6045af-81ce-4d14-b3fa-7be8717ed4fa”,
“result”: [23.85452281230589],
“token”: “ba76d80c-c682-4586-81f4-c614bd00698e”
}]
]
}, {
“TRIL”: [
[{
“cycle”: 150,
“error”: 85.41654636000007,
“id”: “2007ff9c-c912-4599-8a44-4a6906ce9e69”,
“result”: [13.52],
“token”: “4431d863-6794-44f3-8942-106ff19e6f47”
}, {
“cycle”: 141,
“error”: 67.32204164000001,
“id”: “5f199162-70d3-4505-9949-6969424eceb8”,
“result”: [12.75],
“token”: “3cf4bf19-817e-406a-94f5-94c8a32956bd”
}]
]
}]
}

i like php but someone who uses word press EWWWW be more original… also this is not your git hub right ? ajmal017 · GitHub

Nope. You can type all of these in a browser. Will also create a mobile app. Well the server is very small for now so a few stocks at a time only :slight_smile:

Marc
http://www.berrye.com