Repository files navigation
Stream real time stock market data with the polygon websocket api. Allow users to scan and filter real time market data for triggers/set ups based on "The Strat" trading strategy. Users can create watch lists and stream data for specific symbols and save preferences for specific set ups. Users can also get alerts when stocks on their watch list trigger a set up from the user's preferences.
External WebSockets API - Polygon.io
Stream aggregates (1 min or 1 sec) to Java server which will act as a client for the API
Server - Java/Spring Boot
User Accounts
ability to save user strategy and stock symbol preferences for a custom watch list
receive alerts based on preferences selected
Filter incoming market data based on stock symbols list (have a default filter of data incoming on load, or require user to select a specific strategy?)
Initial iteration will use either the Weekly or Daily time frame
further filter by specific "set-ups"
create enums for strategies and stock symbols
logic to determine strategies with incoming data
Test with Junit/mockito
client to retrieve data from java server
display a table of set ups based on filtering
Tables for User, User Preferences, Watch Lists
id - PK
username - unique
password
email - unique
Controller UserController
updateUser PUT /users/{id]
List<Users> getUsers()
Users getUser(Long id)
Users createUser(Users user)
Users updateUser(Long id, Users user)
Controller AuthenticationController
id - PK
name
user_id - FK (users)
Controller WatchlistController
getDefaultWatchlist GET /default-watchlist
getWatchlists GET /watchlists
getWatchlist GET /watchlists/{id}
createWatchlist POST /watchlists
updateWatchlist PUT /watchlists/{id}
deleteWatchlist DELETE /watchlists/{id}
List<WatchlistStock> getDefaultWatchlistStocks()
List<Watchlists> getWatchlist(Long userId)
Watchlists getWatchlist(Long id)
Watchlists createWatchList(Watchlists watchlist
Watchlists updateWatchlists(Long id, Watchlists watchlist)
void deleteWatchlist(Long id)
id - PK
watchlist_id FK (watchlist)
stock_symbol
Controller WatchlistStockController
getDefaultWatchlistStocks GET /watchlists/stock/aggregates?timeframe=X
getAggregatesByWatchlistIdStockAndTimeframe GET /watchlists/{watchlistId}/stocks/aggregates?timeframe=X
addStockToWatchlist POST /watchlists/{watchlistId}/stocks
deleteStockFromWatchlist DELETE /watchlists/{watchlistId}/stocks/{stock}
Service WatchlistStockService
List <WatchlistStocks> getStocks(Long watchlistId)
WatchlistStocks getStock(Long id)
WatchlistStocks addStock(WatchlistStocks stock)
void removeStock(Long id)
id - PK
timeframe
stock_symbol
open
close
high
low
start_time
end_time
scenario
trigger_price
target_price
AggregationCalculationService
method to call on the calculate methods
double calculateHighPrice(List<Aggregates> aggregates)
double calculateLowPrice(List<Aggregates> aggregates)
double calculateOpenPrice(List<Aggregates> aggregates)
double calculateClosePrice(List<Aggregates> aggregates)
double calculateTriggerPriceUp(List<Aggregates> aggregates)
double calculateTriggerPriceDown(List<Aggregates> aggregates)
double calculateTargetPriceUp(List<Aggregates> aggregates)
double calculateTargetPriceDown(List<Aggregates> aggregates)
LocalDateTime calculateStartTime(List<Aggregates> aggregates)
LocalDateTime calculateEndTime(List<Aggregates> aggregates)
AggregationAbstractClass Abstract Class
protected abstract List<Aggregates> queryAggregates(String stockSymbol, TimeframeEnums timeframe)
protected Aggregate convertToHigherTimeFrame(List<Aggregates> lowerTimeframe)
Will need to call on calculate high and low price, open close, start and end time methods from main service class
protected void saveAggregates(Aggregate higherTimeFrame)
public void execute(String stockSymbol, TimeframeEnums timeframe)
calls on queryAggregates, converToHigherTimeframe & saveAggregates within method block
needs to call on scenarios method, trade actions methods before saving
AggregationConversion getService(TimeframeEnums timeframe)
use switch statement for timeframe enums
*@Scheduled(cron = "0 /5 * * * MON-FRI", zone = "America/New_York")
void runFiveMinuteAggregation()
method to get watchlist_stocks, conditional for if theres a user or not to either fetch user stocks or default list stocks
execute()
*@Scheduled(cron = "0 /15 * * * MON-FRI", zone = "America/New_York")
void runFifteenMinuteAggregation()
*@Scheduled(cron = "0 /30 * * * MON-FRI", zone = "America/New_York")
void runThirtyMinuteAggregation()
@Scheduled(cron = "0 0 * * * MON-FRI", zone = "America/New_York")
void runSixtyMinuteAggregation()
@Scheduled(cron = "0 0 16 * * MON-FRI", zone = "America/New_York")
void runDailyAggregation()
FiveMinuteAggregationService extends AggregationConversion
@Override List<Aggregates> queryAggregates(String stockSymbol, TimeframeEnums timeframe)
FifteenMinuteAggregationService extends AggregationConversion
@Override List<Aggregates> queryAggregates(String stockSymbol, TimeframeEnums timeframe)
ThirtyMinuteAggregationService extends AggregationConversion
@Override List<Aggregates> queryAggregates(String stockSymbol, TimeframeEnums timeframe)
SixtyMinuteAggregationService extends AggregationConversion
@Override List<Aggregates> queryAggregates(String stockSymbol, TimeframeEnums timeframe)
DailyAggregationService extends AggregationConversion
@Override List<Aggregates> queryAggregates(String stockSymbol, TimeframeEnums timeframe)
id - PK
timeframe
alert_time
alert_status
alert_type
watclist_stock_id - FK (watchlist_stocks)
Controller StockAlertController
deleteAlert DELETE /alerts/{id}
Service StockAlertService
List<StockAlert> getAllAlerts()
StockAlerts createAlert(StockAlerts alert)
void deleteAlerts(Long id)
ScenarioEnums determineScenarios(List<Aggregates> recentAggregates
boolean isInsiderBar(Aggregate first, Aggregate second, Aggregate third)
boolean isDirectionalBarUp(Aggregate first, Aggregate second, Aggregate third)
boolean isDirectionalBarDown(Aggregate first, Aggregate second, Aggregate third)
boolean isOutsideBar(Aggregate first, Aggregate second, Aggregate third)
INSIDE_BAR
DIRECTIONAL_BAR_UP
DIRECTIONAL_BAR_DOWN
OUTSIDE_BAR
ONE_MIN
FIVE_MIN
FIFTEEN_MIN
THIRTY_MIN
SIXTY_MIN
DAY
ACTIVE
INACTIVE
TRIGGERED
CANCELLED
TRIGGER_UP
TRIGGER_DOWN
TARGET_UP
TARGET_DOWN
AAPL("Apple Inc."),
MSFT("Microsoft Corporation"),
AMZN("Amazon.com, Inc."),
GOOGL("Alphabet Inc. (Class A)"),
GOOG("Alphabet Inc. (Class C)"),
FB("Facebook, Inc."),
TSLA("Tesla, Inc."),
BRK_B("Berkshire Hathaway Inc. (Class B)"),
JNJ("Johnson & Johnson"),
V("Visa Inc."),
WMT("Walmart Inc."),
PG("Procter & Gamble Co."),
MA("Mastercard Incorporated"),
NVDA("NVIDIA Corporation"),
HD("The Home Depot, Inc."),
PYPL("PayPal Holdings, Inc."),
DIS("The Walt Disney Company"),
ADBE("Adobe Inc."),
NFLX("Netflix, Inc."),
CMCSA("Comcast Corporation"),
PEP("PepsiCo, Inc."),
CSCO("Cisco Systems, Inc."),
XOM("Exxon Mobil Corporation"),
INTC("Intel Corporation"),
KO("The Coca-Cola Company");
websocket client
return new standard websocket client
websocket connection manager
new websocket connection manager
new polygon websocket handler
auth after connection
handle message
handle status
subscribe to watchlist stocks
public static boolean isMarketOpen()
About
Stock Scanner App - Java/Angular
Topics
Resources
Stars
Watchers
Forks
You can’t perform that action at this time.