Backtesting

Backtesting

Run screener backtesting. (Professional Only)

Request

POST /screeners/stocks

Request body

Request body should be a JSON object containing the following properties:
  • exchanges Required|Array
    Exchanges list of backtesting
  • filters Required|Array
    Filters list of backtesting, eg:
    
    [
          {
              "left": "pettm",
              "operator": "<=",
              "right": "10"
          },
          {
              "left": "mktcap_norm",
              "operator": ">=",
              "right": "1000"
          },
          {
              "left": "equity2asset",
              "operator": ">=",
              "right": "0.5"
          }
    ]
                
  • fields Required|Array
    Fields list of backtesting stocks, eg: ["symbol","exchange","price","mktcap_norm"]
  • history Required|String
    Backtesing month, should be 6 digitals date, eg: "202201", empty for current
  • sort Required|String
    Result order, eg: "price|DESC" will sort the result by price desc or asc
  • page Required|Number
    Result page, eg: 1
  • per_page Required|Number
    Result per page, eg: 20, maxmium 100

Example


{
    "page":1,
    "per_page":10,
    "exchanges": [
        "NAS",
        "NYSE"
    ],
    "fields": [
        "symbol",
        "exchange",
        "company",
        "price",
        "currency",
        "stockid",
        "morn_secr_id",
        "display_symbol",
        "pettm",
        "industry",
        "country"
    ],
    "page": 1,
    "per_page": 10,
    "filters": [
        {
            "left": "pettm",
            "operator": "<=",
            "right": "20"
        },
        {
            "left": "mktcap_norm",
            "operator": ">=",
            "right": "1000"
        },
        {
            "left": "equity2asset",
            "operator": ">=",
            "right": "0.5",
            "field_id": 100
        }
    ],
    "sort": "mktcap_norm|asc",
    "history": "202301"
}
        

Response

Response will be an array containing the list of filtered stocks in certain month.

{
    "total": 523,
    "per_page": 10,
    "current_page": 1,
    "last_page": 53,
    "from": 1,
    "to": 10,
    "data": [
        {
            "symbol": "FSLY",
            "exchange": "NYSE",
            "company": "Fastly Inc",
            "price": 8.19,
            "currency": "USD",
            "morn_secr_id": "0P0001HG3Z",
            "display_symbol": "FSLY",
            "pettm": "0.00",
            "industry": "Software",
            "country": "USA"
        },
        {
            "symbol": "IOVA",
            "exchange": "NAS",
            "company": "Iovance Biotherapeutics Inc",
            "price": 6.39,
            "currency": "USD",
            "morn_secr_id": "0P0000KXRO",
            "display_symbol": "IOVA",
            "pettm": "0.00",
            "industry": "Biotechnology",
            "country": "USA"
        },
        {
            "symbol": "HOLI",
            "exchange": "NAS",
            "company": "Hollysys Automation Technologies Ltd",
            "price": 16.43,
            "currency": "USD",
            "morn_secr_id": "0P0000COYS",
            "display_symbol": "HOLI",
            "pettm": "11.18",
            "industry": "Industrial Products",
            "country": "China"
        },
        {
            "symbol": "OLO",
            "exchange": "NYSE",
            "company": "Olo Inc",
            "price": 6.25,
            "currency": "USD",
            "morn_secr_id": "0P0001LW46",
            "display_symbol": "OLO",
            "pettm": "0.00",
            "industry": "Software",
            "country": "USA"
        },
        {
            "symbol": "USNA",
            "exchange": "NYSE",
            "company": "Usana Health Sciences Inc",
            "price": 53.2,
            "currency": "USD",
            "morn_secr_id": "0P000005OU",
            "display_symbol": "USNA",
            "pettm": "13.43",
            "industry": "Consumer Packaged Goods",
            "country": "USA"
        },
        {
            "symbol": "BBN",
            "exchange": "NYSE",
            "company": "BlackRock Taxable Municipal Bond Trust",
            "price": 16.84,
            "currency": "USD",
            "morn_secr_id": "0P0000P0UV",
            "display_symbol": "BBN",
            "pettm": "0.00",
            "industry": "Asset Management",
            "country": "USA"
        },
        {
            "symbol": "FPF",
            "exchange": "NYSE",
            "company": "First Trust Inter Dur Pref& Income Fund",
            "price": 16.87,
            "currency": "USD",
            "morn_secr_id": "0P0000YW06",
            "display_symbol": "FPF",
            "pettm": "0.00",
            "industry": "Asset Management",
            "country": "USA"
        },
        {
            "symbol": "BLU",
            "exchange": "NAS",
            "company": "BELLUS Health Inc",
            "price": 8.22,
            "currency": "USD",
            "morn_secr_id": "0P000003V6",
            "display_symbol": "BLU",
            "pettm": "0.00",
            "industry": "Biotechnology",
            "country": "Canada"
        },
        {
            "symbol": "OTLY",
            "exchange": "NAS",
            "company": "Oatly Group AB",
            "price": 1.74,
            "currency": "USD",
            "morn_secr_id": "0P0001MF9X",
            "display_symbol": "OTLY",
            "pettm": "0.00",
            "industry": "Beverages - Non-Alcoholic",
            "country": "Sweden"
        },
        {
            "symbol": "MORF",
            "exchange": "NAS",
            "company": "Morphic Holding Inc",
            "price": 26.75,
            "currency": "USD",
            "morn_secr_id": "0P0001HS6O",
            "display_symbol": "MORF",
            "pettm": "0.00",
            "industry": "Biotechnology",
            "country": "USA"
        }
    ]
}

Available Backtesting fields

Available fields of backtesting. (Professional Only)

Request

GET /screeners/fields

Example

/screeners/fields

Response

Response will be an array containing the list of fields.

[
  {
      "field_name": "exchange",
      "display_name": "Exchange",
      "field_type": "string",
      "description": "The company's stock exchange. Example: NAS for Apple."
  },
  {
      "field_name": "symbol",
      "display_name": "Symbol",
      "field_type": "string",
      "description": "The company's stock ticker symbol"
  },
  {
      "field_name": "display_symbol",
      "display_name": "Display Symbol",
      "field_type": "string",
      "description": "Not in database."
  },
  {
      "field_name": "industry",
      "display_name": "Industry",
      "field_type": "industry",
      "description": "The company's industry. Example: Discount Stores for WMT."
  }
]
          

Continue to read: Code Examples - JAVA