I am trying to get a list of orders, but it seems like the API isn’t working:
(ns tradeur.core
(:require [clj-http.client :as client]
[clojure.data.json :as json])
(:gen-class))
(defn get-orders [& [opt]]
(let [call-url (str "https://paper-api.alpaca.markets/v2/orders")
response (client/get call-url
{:headers {:APCA-API-KEY-ID account-id,
:APCA-API-SECRET-KEY account-secret}}
:body (json/write-str {:direction "asc"}))
response-body (:body response)]
(json/read-str response-body)))
this doesn’t seem like the API listens to the parameters for getting a list of orders. Here I am forcing it to be ascending by default (an easy test) which it fails.
Also the docs say that status is limited open
, closed
or all
. Defaults to open
. However, I am finding that my orders are marked as ‘accepted’, which is not one of those 3.
Sorry I am new to this, my mistakes are my own.