mafischer / trader-bot

A stock trading bot with trade strategy plugins.
ISC License
26 stars 7 forks source link

Add Fidelity broker #7

Open mafischer opened 3 years ago

mafischer commented 3 years ago

Add Fidelity broker

mafischer commented 3 years ago

method: POST endpoint: https://brokerage.fidelity.com/ftgw/brkg/equityticket/balance body:

{"acctNum": "X00000000"}

resposne:

[
  {
    "acctNum": "X00000000",
    "brokerageAcctDetail": {
      "asOfDateTime": 1612201675,
      "recentBalanceDetail": {
        "asOfDateTime": 1612201675,
        "acctValDetail": {
          "netWorth": 1.00,
          "netWorthChg": 1.00,
          "netWorthChgPct": 0.00,
          "marketVal": 1.00,
          "marketValChg": 0.00,
          "marketValChgPct": 0.00,
          "acctEqtyPct": 100,
          "hasUnpricedPosition": false,
          "regulatoryNetWorth": 1.00
        },
        "cashDetail": {
          "heldInCash": 1.00,
          "heldInCashChg": 0.00,
          "coreBalance": 110,
          "creditDebit": -0.58,
          "creditDebitChg": 0,
          "settledAmt": 1.00
        },
        "buyingPowerDetail": {
          "cash": 1.00,
          "cashChg": 0,
          "margin": 1.00,
          "marginChg": 0,
          "nonMargin": 1.00,
          "nonMarginChg": 0,
          "withoutMarginImpact": 1.00,
          "withoutMarginImpactChg": 0,
          "cashCmtdToOpenOrder": 0,
          "cashMarginCmtdToOpenOrder": 0
        }
      }
    }
  }
]
mafischer commented 3 years ago

method: POST endpoint: https://brokerage.fidelity.com/ftgw/brkg/equityticket/getquote body:

{
    "symbols": "EXROF"
}

resposne:

{
    "SYMBOL": "EXROF",
    "STATUS": {
        "ERROR_CODE": "0",
        "ERROR_TEXT": ""
    },
    "QUOTE_DATA": {
        "ASK_PRICE": "2.97",
        "ASK_SIZE": "18700",
        "BID_PRICE": "2.95",
        "BID_SIZE": "1967",
        "LAST_PRICE": "2.95",
        "LAST_SIZE": "100",
        "NETCHG_TODAY": "0.02",
        "NAME": "EXRO TECHNOLOGIES INC",
        "PCT_CHG_TODAY": "0.682594",
        "VOLUME": "240163",
        "EXCHANGE_TRADED_TYPE": "",
        "CUSIP": "30222R109",
        "OPEN_PRICE": "3.00",
        "PREV_CLOSE_PRICE": "2.93",
        "AVG_VOL_90_DAY": "534746",
        "EARNING_QTR_REPORT_DATE": "",
        "CASH_DIV_EX_DATE": "",
        "DAY_HIGH": "3.04",
        "DAY_LOW": "2.83",
        "YEAR_HIGH_PRICE": "3.93",
        "YEAR_LOW_PRICE": "0.15",
        "FINANCIAL_STAT_IND": "N",
        "EARNING_PRIOR_QTR_REPORT_DATE": "",
        "TRADING_SYMBOL": "",
        "ASK_EXCHANGE_MIC": "",
        "BID_EXCHANGE_MIC": "",
        "LAST_EXCHANGE_MIC": "",
        "SECURITY_TYPE": "Equity"
    }
}
mafischer commented 3 years ago

method: POST endpoint: https://brokerage.fidelity.com/ftgw/brkg/equityticket/extendedhour body: n/a response:

{
    "sessionType": "CLO"
}
mafischer commented 3 years ago

method: GET endpoint: https://www.fidelity.com/search/autosuggest?callback=searchJSONCallback&q=ts response:

[
    {
        "quotes": {
            "count": 6,
            "suggestions": [
                {
                    "term": "TS",
                    "count": 334,
                    "desc": "TENARIS ADR REP 2 ORD SHS",
                    "symbol": "TS",
                    "cusip": "88031M109",
                    "url": "https://eresearch.fidelity.com/eresearch/goto/evaluate/snapshot.jhtml?symbols=TS"
                },
                {
                    "term": "TSLA",
                    "count": 31277192,
                    "desc": "TESLA ORD SHS",
                    "symbol": "TSLA",
                    "cusip": "88160R101",
                    "url": "https://eresearch.fidelity.com/eresearch/goto/evaluate/snapshot.jhtml?symbols=TSLA"
                },
                {
                    "term": "TSM",
                    "count": 4957258,
                    "desc": "TAIWAN SEMICONDUCTOR MANUFACTURING ADR REPRESENTING FIVE ORD SHS",
                    "symbol": "TSM",
                    "cusip": "874039100",
                    "url": "https://eresearch.fidelity.com/eresearch/goto/evaluate/snapshot.jhtml?symbols=TSM"
                },
                {
                    "term": "TSNP",
                    "count": 2327978,
                    "desc": "TESORO ENTERPRISES ORD SHS",
                    "symbol": "TSNP",
                    "cusip": "881608103",
                    "url": "https://eresearch.fidelity.com/eresearch/goto/evaluate/snapshot.jhtml?symbols=TSNP"
                },
                {
                    "term": "TSN",
                    "count": 868906,
                    "desc": "TYSON FOODS ORD SHS CLASS A",
                    "symbol": "TSN",
                    "cusip": "902494103",
                    "url": "https://eresearch.fidelity.com/eresearch/goto/evaluate/snapshot.jhtml?symbols=TSN"
                },
                {
                    "term": "TSCO",
                    "count": 534747,
                    "desc": "TRACTOR SUPPLY ORD SHS",
                    "symbol": "TSCO",
                    "cusip": "892356106",
                    "url": "https://eresearch.fidelity.com/eresearch/goto/evaluate/snapshot.jhtml?symbols=TSCO"
                }
            ]
        }
    },
    {
        "keywords": {
            "count": 0,
            "suggestions": []
        }
    },
    {
        "exception": []
    }
]