FCS WebSocket Python v4.0.0
First Release - Python WebSocket client for real-time Forex, Crypto, and Stock market data from FCS API.
What's New
Initial release with complete WebSocket implementation:
- Real-time Streaming - Live OHLCV and Ask/Bid price updates (1-5 second updates)
- Multi-Market Support - Forex (FX:EURUSD), Crypto (BINANCE:BTCUSDT), Stocks (NASDAQ:AAPL)
- Decorator-Based API - Simple event handling with Python decorators
- Auto-Reconnect - Automatic reconnection with configurable retry limit
- Background Threading - Non-blocking mode for concurrent operations
- Zero Dependencies - Pure Python implementation using built-in websocket
- Easy Integration - Simple method calls with clean API
Installation
pip install fcsapi-websocketQuick Start
from fcs_client_lib import FCSClient
client = FCSClient('YOUR_API_KEY')
@client.on_message
def handle_message(data):
if data.get('type') == 'price':
symbol = data.get('symbol')
price = data['prices'].get('c')
print(f'{symbol}: ${price}')
client.connect()
client.join('BINANCE:BTCUSDT', '1D')
client.run_forever()Background Mode (Non-blocking)
client.connect()
client.run_forever(blocking=False) # Runs in background thread
# Your code continues here...Examples Included
simple_example.py- Basic price streamingforex_example.py- Forex pairs with spread calculationcrypto_example.py- Bitcoin, Ethereum real-time pricesbackground_example.py- Non-blocking background modestock_example.py- Stock prices (AAPL, TSLA, GOOGL)
Supported Markets
- Forex: FX:EURUSD, FX:GBPUSD, FX:USDJPY
- Crypto: BINANCE:BTCUSDT, BINANCE:ETHUSDT
- Stocks: NASDAQ:AAPL, NYSE:TSLA
Timeframes
1m, 5m, 15m, 30m, 1h, 4h, 1D, 1W, 1M
Demo Access
Test without signup: fcs_socket_demo
Requirements
- Python 3.8 or higher
- No external dependencies
Documentation
- Full docs: https://fcsapi.com/document/stock-api#websocket
- PyPI package: https://pypi.org/project/fcsapi-websocket/
- GitHub: https://github.com/fcsapi/websocket-python
- Support: support@fcsapi.com
Get API Key
Sign up for free at https://fcsapi.com