Skip to content

Commit

Permalink
Refactor project setup to use pnpm, update README with detailed confi…
Browse files Browse the repository at this point in the history
…guration and usage instructions, and modify package.json scripts for production start. Added new dependencies and updated lockfile version.
  • Loading branch information
arunkumar201 committed Jan 16, 2025
1 parent 9cff5c7 commit 3f1ffd0
Show file tree
Hide file tree
Showing 3 changed files with 4,631 additions and 3,524 deletions.
72 changes: 59 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,72 @@
# Nadex Bot

Nadex Bot is an automated trading application designed to interact with the Nadex platform, allowing users to place binary options orders programmatically. This README provides detailed instructions on configuring, running, and using the Nadex Bot and its associated dashboard.

## Prerequisites

- Ensure you have [pnpm](https://pnpm.io/) installed on your system.
- Create a `.env` file in the root of the project and in the `nadex-bot-dashboard` folder, based on the respective `.env.example` files.

## Configuration
- Create a `.env` file in the root of the project according to `.env.example` and add the following environment variables.
- also create .env inside the nadex-bot-dashboard folder and add the following environment variables as per.
`.env.example` in the nadex-bot-dashboard folder.

1. **Root Configuration:**
- Create a `.env` file in the root directory of the project.
- Populate it with the necessary environment variables as specified in the `.env.example` file.

2. **Dashboard Configuration:**
- Create a `.env` file inside the `nadex-bot-dashboard` folder.
- Add the required environment variables as per the `.env.example` file in the `nadex-bot-dashboard` folder.

## Running the Application

To start the bot api server
```
1. pnpm i
2. pnpm build
3. pnpm start:prod
### Starting the Bot API Server

To start the bot API server, execute the following commands:

```bash
pnpm install
pnpm start:prod
```
- start the Nadex Bot - it will open the nadex site and login as we configured credential in .env file.
``` bash
pnpm start:nadex

### Starting the Nadex Bot

The Nadex Bot will open the Nadex site and log in using the credentials configured in the `.env` file. To start the bot, run:

```bash
pnpm start:nadex
```
- start the Nadex Bot Dashboard - it will open the dashboard in the browser.
``` bash

### Starting the Nadex Bot Dashboard

The dashboard provides a user interface to interact with the bot. To launch the dashboard in your browser, execute:

```bash
pnpm start:dashboard
```

## Placing an Order on Nadex

To place a binary order on Nadex, make a POST request to the following endpoint:

```
POST http://localhost:8000/nadex/place-binary-order
```

### Request Payload

The request should include a JSON payload with the following structure:

```json
{
"symbol": "USD/JPY", // The currency pair you want to trade
"orderAction": "BUY", // Action to perform: BUY or SELL
"orderType": "LIMIT", // Type of order: LIMIT or MARKET
"selectedDuration": "5 minute" // Duration for the order: e.g., 5 minute etc
}
```

## Additional Information

- Ensure that your `.env` files are correctly configured with the necessary credentials and environment variables.
- The Nadex Bot will automatically log in to the Nadex site using the credentials provided in the `.env` file.
- The Nadex Bot Dashboard provides a user interface to interact with the bot and place orders on Nadex.
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"dev": "nodemon --ext ts",
"build": "tsc -p .",
"start:prod": "yarn build && node dist/index.js",
"start:prod": "pnpm run build && node dist/src/index.js",
"format": "prettier --write src",
"lint": "eslint src/**/*.ts",
"lint:fix": "eslint src/**/*.ts --fix",
Expand All @@ -16,26 +16,27 @@
},
"husky": {
"hooks": {
"pre-commit": "yarn lint:fix"
"pre-commit": "pnpm lint:fix"
}
},
"workspaces": [
"nadex-bot-dashboard",
"nadex-bot"
],
"workspaces": [
"nadex-bot-dashboard",
"nadex-bot"
],
"lint-staged": {
"**/*": "prettier --write --ignore-unknown"
},
"engines": {
"node": ">=18",
"yarn": "3.4.1"
"pnpm": ">=8.10.0"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@commitlint/cli": "^19.4.0",
"@commitlint/config-conventional": "^19.2.2",
"@types/body-parser": "^1.19.5",
"@types/compression": "^1.7.3",
"@types/cookie-parser": "^1.4.4",
"@types/cors": "^2.8.14",
Expand Down Expand Up @@ -88,5 +89,5 @@
"optionalDependencies": {
"bufferutil": "^4.0.8"
},
"packageManager": "yarn@4.4.1"
"packageManager": "pnpm@8.10.0"
}
Loading

0 comments on commit 3f1ffd0

Please sign in to comment.