This project serves as a backend server to consume Fyers API's for various functionalities including fetching current holdings, placing buy and sell orders, handling postback from the broker, and getting prices from WebSocket.
- Clone the repository.
- Install dependencies using
npm install
. - Set up the required configurations in the
config.js
file. - Start the server using
npm start
.
- Authentication Middleware: Implemented a middleware for authentication to ensure that all requests are properly authenticated before accessing the routes.
- Schema Implementation: Implemented schemas using Zod for request validation to ensure that all incoming requests are structured correctly and free from errors.
- Routes: Created routes for various functionalities including multi-buy order placement, single buy order placement, sell order placement, handling postback from the broker, and starting a WebSocket connection to get prices.
- Error Handling: Proper error handling is implemented throughout the application to handle any unexpected errors and provide meaningful responses to the clients.
- Full Safe Endpoint: Ensured that all endpoints are full safe, meaning requests are properly structured and validated before processing, thus minimizing the chances of errors.
- /multi-buy-order: Endpoint for placing multi-buy orders.
- /buy-order: Endpoint for placing single buy orders.
- /sell-order: Endpoint for placing sell orders.
- /postback: Endpoint to handle postback from the broker.
- /websocket: Endpoint to start a WebSocket connection for getting prices.
- Node.js
- Express.js
- Axios
- Zod