This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import asyncio | |
| import logging | |
| import os | |
| from collections import deque | |
| from typing import Callable | |
| import requests | |
| logger = logging.getLogger(__name__) | |
| SYMBOLS = ["SPY", "QQQ"] | |
| BAR_WINDOW = 50 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import asyncio, logging, os | |
| from collections import deque | |
| from datetime import datetime, timezone, timedelta | |
| from typing import Callable | |
| import requests | |
| logger = logging.getLogger(__name__) | |
| SYMBOLS = ["SPY", "QQQ"] | |
| BAR_WINDOW = 50 | |
| POLL_INTERVAL = 60 # seconds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import asyncio, logging, os | |
| from collections import deque | |
| from typing import Callable | |
| from alpaca.data.live import StockDataStream | |
| from alpaca.data.enums import DataFeed | |
| logger = logging.getLogger(__name__) | |
| SYMBOLS = ["SPY", "QQQ"] | |
| BAR_WINDOW = 50 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import asyncio, logging, os | |
| from collections import deque | |
| from typing import Callable | |
| from alpaca.data.live import StockDataStream | |
| logger = logging.getLogger(__name__) | |
| SYMBOLS = ["SPY", "QQQ"] | |
| BAR_WINDOW = 50 | |
| class BarFeed: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| HFT Momentum Scalper — entry point. | |
| Runs the async engine + FastAPI dashboard concurrently. | |
| """ | |
| import asyncio | |
| import logging | |
| import sys | |
| from pathlib import Path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Real-time 1-minute bar feed via Alpaca WebSocket. | |
| Maintains a rolling window of bars per symbol for signal calculation. | |
| """ | |
| import asyncio | |
| import logging | |
| import os | |
| from collections import deque | |
| from datetime import datetime, timezone |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| FastAPI dashboard for HFT Scalper — port 8082. | |
| """ | |
| import logging | |
| from datetime import datetime, timezone | |
| from pathlib import Path | |
| from fastapi import FastAPI, Request | |
| from fastapi.responses import HTMLResponse, JSONResponse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| HFT Scalper Engine — main event loop. | |
| Wires together: feed → signals → risk → broker → logger. | |
| """ | |
| import asyncio | |
| import logging | |
| from datetime import datetime, timezone | |
| from typing import Dict, List, Optional |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Trade logger — writes every trade to a JSON log file and maintains | |
| a running performance summary for the dashboard. | |
| """ | |
| import json | |
| import logging | |
| from datetime import datetime, timezone | |
| from pathlib import Path | |
| from typing import Dict, List |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Order router for HFT scalper. | |
| Uses Alpaca REST API for fast market order execution. | |
| Tracks open positions and handles bracket orders (entry + stop + target). | |
| """ | |
| import logging | |
| import os | |
| from datetime import datetime, timezone | |
| from typing import Dict, List, Optional |
NewerOlder