|
| 1 | +# FCS API - C# Functions Reference |
| 2 | + |
| 3 | +Quick reference for all available functions in the FCS API C# library. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Authentication Methods |
| 8 | + |
| 9 | +```csharp |
| 10 | +using FcsApi; |
| 11 | + |
| 12 | +// Method 1: Default (uses key from FcsConfig.cs) |
| 13 | +var fcsapi = new FcsApi.FcsApi(); |
| 14 | + |
| 15 | +// Method 2: Pass API Key directly (override) |
| 16 | +var fcsapi = new FcsApi.FcsApi("YOUR_API_KEY"); |
| 17 | + |
| 18 | +// Method 3: IP Whitelist (no key needed if IP whitelisted in account) |
| 19 | +var config = FcsConfig.WithIpWhitelist(); |
| 20 | +var fcsapi = new FcsApi.FcsApi(config); |
| 21 | + |
| 22 | +// Method 4: Token-Based (secure for frontend apps) |
| 23 | +var config = FcsConfig.WithToken("API_KEY", "PUBLIC_KEY", 3600); |
| 24 | +var fcsapi = new FcsApi.FcsApi(config); |
| 25 | +var tokenData = fcsapi.GenerateToken(); // Send to frontend |
| 26 | +``` |
| 27 | + |
| 28 | +### Set Default API Key |
| 29 | +Edit `src/FcsConfig.cs` and set your key: |
| 30 | +```csharp |
| 31 | +public string AccessKey { get; set; } = "YOUR_API_KEY_HERE"; |
| 32 | +``` |
| 33 | + |
| 34 | +### Token Expiry Values |
| 35 | +| Seconds | Duration | |
| 36 | +|---------|----------| |
| 37 | +| 300 | 5 minutes | |
| 38 | +| 900 | 15 minutes | |
| 39 | +| 1800 | 30 minutes | |
| 40 | +| 3600 | 1 hour | |
| 41 | +| 86400 | 24 hours | |
| 42 | + |
| 43 | +--- |
| 44 | + |
| 45 | +## Crypto Functions |
| 46 | + |
| 47 | +```csharp |
| 48 | +fcsapi.Crypto.GetSymbolsList(type, subType, exchange) |
| 49 | +fcsapi.Crypto.GetCoinsList() |
| 50 | +fcsapi.Crypto.GetLatestPrice(symbol, period, type, exchange, getProfile) |
| 51 | +fcsapi.Crypto.GetAllPrices(exchange, period, type) |
| 52 | +fcsapi.Crypto.GetCoinData(symbol, limit, sortBy) |
| 53 | +fcsapi.Crypto.GetTopByMarketCap(limit) |
| 54 | +fcsapi.Crypto.GetTopByRank(limit) |
| 55 | +fcsapi.Crypto.Convert(pair1, pair2, amount) |
| 56 | +fcsapi.Crypto.GetBasePrices(symbol, exchange, fallback) |
| 57 | +fcsapi.Crypto.GetCrossRates(symbol, exchange, type, period, crossrates, fallback) |
| 58 | +fcsapi.Crypto.GetHistory(symbol, period, length, fromDate, toDate, page, isChart) |
| 59 | +fcsapi.Crypto.GetProfile(symbol) |
| 60 | +fcsapi.Crypto.GetExchanges(type, subType) |
| 61 | +fcsapi.Crypto.Advanced(params) |
| 62 | +fcsapi.Crypto.GetMovingAverages(symbol, period, exchange) |
| 63 | +fcsapi.Crypto.GetIndicators(symbol, period, exchange) |
| 64 | +fcsapi.Crypto.GetPivotPoints(symbol, period, exchange) |
| 65 | +fcsapi.Crypto.GetPerformance(symbol, exchange) |
| 66 | +fcsapi.Crypto.GetTopGainers(exchange, limit, period, type) |
| 67 | +fcsapi.Crypto.GetTopLosers(exchange, limit, period, type) |
| 68 | +fcsapi.Crypto.GetHighestVolume(exchange, limit, period, type) |
| 69 | +fcsapi.Crypto.GetSortedData(sortColumn, sortDirection, limit, type, exchange, period) |
| 70 | +fcsapi.Crypto.Search(query, type) |
| 71 | +fcsapi.Crypto.MultiUrl(urls, baseUrl) |
| 72 | +``` |
| 73 | + |
| 74 | +### Parameters |
| 75 | +| Parameter | Values | |
| 76 | +|-----------|--------| |
| 77 | +| `type` | crypto, coin, futures, dex, dominance | |
| 78 | +| `subType` | spot, swap, index | |
| 79 | +| `exchange` | BINANCE, COINBASE, KRAKEN, BYBIT | |
| 80 | +| `period` | 1m, 5m, 15m, 30m, 1h, 4h, 1D, 1W, 1M | |
| 81 | +| `sortBy` | perf.rank_asc, perf.market_cap_desc, perf.circulating_supply_desc | |
| 82 | +| `sortColumn` | active.c, active.chp, active.v, active.h, active.l, perf.rank, perf.market_cap | |
| 83 | +| `sortDirection` | asc, desc | |
| 84 | + |
| 85 | +--- |
| 86 | + |
| 87 | +## Forex Functions |
| 88 | + |
| 89 | +```csharp |
| 90 | +fcsapi.Forex.GetSymbolsList(type, subType, exchange) |
| 91 | +fcsapi.Forex.GetLatestPrice(symbol, period, type, exchange, getProfile) |
| 92 | +fcsapi.Forex.GetAllPrices(exchange, period, type) |
| 93 | +fcsapi.Forex.GetCommodities(symbol, period) |
| 94 | +fcsapi.Forex.GetCommoditySymbols() |
| 95 | +fcsapi.Forex.Convert(pair1, pair2, amount, type) |
| 96 | +fcsapi.Forex.GetBasePrices(symbol, type, exchange, fallback) |
| 97 | +fcsapi.Forex.GetCrossRates(symbol, type, period, exchange, crossrates, fallback) |
| 98 | +fcsapi.Forex.GetHistory(symbol, period, length, fromDate, toDate, page, isChart) |
| 99 | +fcsapi.Forex.GetProfile(symbol) |
| 100 | +fcsapi.Forex.GetExchanges(type, subType) |
| 101 | +fcsapi.Forex.Advanced(params) |
| 102 | +fcsapi.Forex.GetMovingAverages(symbol, period, exchange) |
| 103 | +fcsapi.Forex.GetIndicators(symbol, period, exchange) |
| 104 | +fcsapi.Forex.GetPivotPoints(symbol, period, exchange) |
| 105 | +fcsapi.Forex.GetPerformance(symbol, exchange) |
| 106 | +fcsapi.Forex.GetEconomyCalendar(symbol, country, fromDate, toDate) |
| 107 | +fcsapi.Forex.GetTopGainers(type, limit, period, exchange) |
| 108 | +fcsapi.Forex.GetTopLosers(type, limit, period, exchange) |
| 109 | +fcsapi.Forex.GetMostActive(type, limit, period, exchange) |
| 110 | +fcsapi.Forex.GetSortedData(sortColumn, sortDirection, limit, type, exchange, period) |
| 111 | +fcsapi.Forex.Search(query, type, exchange) |
| 112 | +fcsapi.Forex.MultiUrl(urls, baseUrl) |
| 113 | +``` |
| 114 | + |
| 115 | +### Parameters |
| 116 | +| Parameter | Values | |
| 117 | +|-----------|--------| |
| 118 | +| `type` | forex, commodity | |
| 119 | +| `subType` | spot, synthetic | |
| 120 | +| `exchange` | FX, ONA, SFO, FCM | |
| 121 | +| `period` | 1m, 5m, 15m, 30m, 1h, 4h, 1D, 1W, 1M | |
| 122 | +| `country` | US, GB, DE, JP, AU, CA | |
| 123 | + |
| 124 | +--- |
| 125 | + |
| 126 | +## Stock Functions |
| 127 | + |
| 128 | +```csharp |
| 129 | +// Symbol/List |
| 130 | +fcsapi.Stock.GetSymbolsList(exchange, country, sector, indices) |
| 131 | +fcsapi.Stock.Search(query, exchange, country) |
| 132 | + |
| 133 | +// Indices |
| 134 | +fcsapi.Stock.GetIndicesList(country, exchange) |
| 135 | +fcsapi.Stock.GetIndicesLatest(symbol, country, exchange) |
| 136 | + |
| 137 | +// Latest Prices |
| 138 | +fcsapi.Stock.GetLatestPrice(symbol, period, exchange, getProfile) |
| 139 | +fcsapi.Stock.GetAllPrices(exchange, period) |
| 140 | +fcsapi.Stock.GetLatestByCountry(country, sector, period) |
| 141 | +fcsapi.Stock.GetLatestByIndices(indices, period) |
| 142 | + |
| 143 | +// Historical |
| 144 | +fcsapi.Stock.GetHistory(symbol, period, length, fromDate, toDate, page, isChart) |
| 145 | + |
| 146 | +// Profile & Info |
| 147 | +fcsapi.Stock.GetProfile(symbol) |
| 148 | +fcsapi.Stock.GetExchanges(type, subType) |
| 149 | + |
| 150 | +// Financial Data |
| 151 | +fcsapi.Stock.GetEarnings(symbol, duration) |
| 152 | +fcsapi.Stock.GetRevenue(symbol) |
| 153 | +fcsapi.Stock.GetDividends(symbol, format) |
| 154 | +fcsapi.Stock.GetBalanceSheet(symbol, duration, format) |
| 155 | +fcsapi.Stock.GetIncomeStatements(symbol, duration, format) |
| 156 | +fcsapi.Stock.GetCashFlow(symbol, duration, format) |
| 157 | +fcsapi.Stock.GetStatistics(symbol, duration) |
| 158 | +fcsapi.Stock.GetForecast(symbol) |
| 159 | +fcsapi.Stock.GetStockData(symbol, dataColumn, duration, format) |
| 160 | + |
| 161 | +// Technical Analysis |
| 162 | +fcsapi.Stock.GetMovingAverages(symbol, period) |
| 163 | +fcsapi.Stock.GetIndicators(symbol, period) |
| 164 | +fcsapi.Stock.GetPivotPoints(symbol, period) |
| 165 | +fcsapi.Stock.GetPerformance(symbol) |
| 166 | + |
| 167 | +// Top Movers & Sorting |
| 168 | +fcsapi.Stock.GetTopGainers(exchange, limit, period, country) |
| 169 | +fcsapi.Stock.GetTopLosers(exchange, limit, period, country) |
| 170 | +fcsapi.Stock.GetMostActive(exchange, limit, period, country) |
| 171 | +fcsapi.Stock.GetSortedData(sortColumn, sortDirection, limit, exchange, country, period) |
| 172 | + |
| 173 | +// Filter |
| 174 | +fcsapi.Stock.GetBySector(sector, limit, exchange) |
| 175 | +fcsapi.Stock.GetByCountry(country, limit, exchange) |
| 176 | + |
| 177 | +// Advanced |
| 178 | +fcsapi.Stock.Advanced(params) |
| 179 | +fcsapi.Stock.MultiUrl(urls, baseUrl) |
| 180 | +``` |
| 181 | + |
| 182 | +### Parameters |
| 183 | +| Parameter | Values | |
| 184 | +|-----------|--------| |
| 185 | +| `type` | stock, index, fund, structured, dr | |
| 186 | +| `subType` | spot, main, cfd, common, preferred | |
| 187 | +| `exchange` | NASDAQ, NYSE, LSE, TSE, HKEX, BSE | |
| 188 | +| `period` | 1m, 5m, 15m, 30m, 1h, 4h, 1D, 1W, 1M | |
| 189 | +| `duration` | annual, interim, both | |
| 190 | +| `format` | plain, inherit | |
| 191 | +| `dataColumn` | earnings, revenue, profile, dividends, balance_sheet, income_statements, statistics, cash_flow | |
| 192 | + |
| 193 | +--- |
| 194 | + |
| 195 | +## Common Response Fields |
| 196 | + |
| 197 | +| Field | Description | |
| 198 | +|-------|-------------| |
| 199 | +| `o` | Open price | |
| 200 | +| `h` | High price | |
| 201 | +| `l` | Low price | |
| 202 | +| `c` | Close/Current price | |
| 203 | +| `v` | Volume | |
| 204 | +| `t` | Unix timestamp | |
| 205 | +| `ch` | Change amount | |
| 206 | +| `chp` | Change percentage | |
| 207 | + |
| 208 | +--- |
| 209 | + |
| 210 | +## Quick Examples |
| 211 | + |
| 212 | +```csharp |
| 213 | +// Initialize (uses key from FcsConfig.cs) |
| 214 | +var fcsapi = new FcsApi.FcsApi(); |
| 215 | + |
| 216 | +// Crypto |
| 217 | +fcsapi.Crypto.GetLatestPrice("BINANCE:BTCUSDT"); |
| 218 | +fcsapi.Crypto.GetHistory("BINANCE:BTCUSDT", "1D", 100); |
| 219 | +fcsapi.Crypto.GetCoinData(null, 50, "perf.rank_asc"); |
| 220 | + |
| 221 | +// Forex |
| 222 | +fcsapi.Forex.GetLatestPrice("FX:EURUSD"); |
| 223 | +fcsapi.Forex.Convert("EUR", "USD", 100); |
| 224 | + |
| 225 | +// Stock |
| 226 | +fcsapi.Stock.GetLatestPrice("NASDAQ:AAPL"); |
| 227 | +fcsapi.Stock.GetTopGainers("NASDAQ", 10); |
| 228 | +fcsapi.Stock.GetEarnings("NASDAQ:AAPL", "annual"); |
| 229 | +fcsapi.Stock.GetDividends("NASDAQ:AAPL"); |
| 230 | +fcsapi.Stock.GetBalanceSheet("NASDAQ:AAPL", "annual"); |
| 231 | +fcsapi.Stock.GetStockData("NASDAQ:AAPL", "profile,earnings,dividends"); |
| 232 | +``` |
| 233 | + |
| 234 | +--- |
| 235 | + |
| 236 | +## Token Authentication Example |
| 237 | + |
| 238 | +```csharp |
| 239 | +// Backend: Generate token |
| 240 | +var config = FcsConfig.WithToken("YOUR_API_KEY", "YOUR_PUBLIC_KEY", 3600); |
| 241 | +var fcsapi = new FcsApi.FcsApi(config); |
| 242 | +var tokenData = fcsapi.GenerateToken(); |
| 243 | + |
| 244 | +// Send tokenData to frontend: |
| 245 | +// { |
| 246 | +// "_token": "abc123...", |
| 247 | +// "_expiry": 1764164233, |
| 248 | +// "_public_key": "your_public_key" |
| 249 | +// } |
| 250 | +
|
| 251 | +// Frontend (JavaScript): Use token |
| 252 | +// fetch('https://api-v4.fcsapi.com/forex/latest?symbol=EURUSD' + |
| 253 | +// '&_public_key=' + tokenData._public_key + |
| 254 | +// '&_expiry=' + tokenData._expiry + |
| 255 | +// '&_token=' + tokenData._token) |
| 256 | +``` |
| 257 | + |
| 258 | +--- |
| 259 | + |
| 260 | +## Get API Key |
| 261 | + |
| 262 | +Get your API key at: https://fcsapi.com |
0 commit comments