Add a stock to the database via the stock service API. Requires admin login.
Add the stock(s) $ARGUMENTS to the portfolio app database.
Login as admin to get a JWT token:
curl -s -X POST http://localhost:8000/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"tunahanyazar0","password":"19482011"}'
Extract the access_token from the response.
Add each stock by calling the stock service:
curl -s -X POST "http://localhost:8001/api/stocks/?stock_symbol=SYMBOL" \
-H "Authorization: Bearer <token>"
.IS (Istanbul Stock Exchange) automaticallyHandle multiple symbols: If comma-separated symbols are provided (e.g. THYAO,BIMAS), split and add each one sequentially.
Report results: For each stock, print whether it was added successfully or if it already exists.
Verify: After adding, query the database to confirm:
docker exec portfolio_mysql mysql -u root -proot Portfolio_Management \
-e "SELECT stock_symbol, name FROM stocks ORDER BY stock_symbol;"
--max-time 120 on curl calls since Yahoo Finance fetches can be slow