WP Bot Lite
- Receive the alert from strategy of TradingView => DONE
- Create order to monitor => TODO
- Integrate to exchange, ex: Binance to trade realtime => TODO
Binance Setup
- Create a Binance Account (This link uses my referral which gives you 5% kickback on trades & would be greatly appreciated)
- Enable Two-factor Authentication in the security section to keep your crypto safe.
- Create a new API key under the API Management section.
- [✓] Read Info [✓] Enable Trading [✓] Enable Futures [X] Enable Withdrawals
- Whitelist your IP address to further secure your account, and so that your API keys don't expire after 3 months.
- Fill in your api keys into api_secret and api_key in Settings
Screen
- Manage Alerts
Technical stack
Using WordPress Rest API, WP-script, React, React Router, Tailwind CSS, PostCSS, Eslint, WP-Data, WP-Data Store, React Components, React CRUD, i18n, PHPUnit Test, JestUnit Test, e2e Test, Gutenberg blocks and PHP OOP plugin architecture easily in a minute.
What's included?
- WordPress Rest API
- WP-script Setup
- React
- React Router
- TypeScript
- Tailwind CSS [Nested + ]
- Scss
- PostCSS
- Eslint
- WP-Data
- WP-Data Redux Store [Redux Saga, Generator function, Thunk, Saga Middleware]
- React Components
- React CRUD Operations - Create, Reade, Update, Delete, Status changes and so many...
- Internationalization - WP i18n
- PHPUnit Test [Test + Fix]
- JestUnit Test
- Jest-Pupetter e2e Test
- PHP OOP plugin architecture [Traits + Interfaces + Abstract Classes]
- Gutenberg blocks
Quick Start
# Clone the Git repository
git clone https://github.com/dearvn/bot-lite.git
# Install PHP-composer dependencies [It's empty]
composer install
# Install node module packages
npm i
# Start development mode
npm start
# Start development with hot reload (Frontend components will be updated automatically if any changes are made)
npm run start:hot
# To run in alertion
npm run build
After running start
, or build
command, there will be a folder called /build
will be generated at the root directory.
Activate the plugin
You need activate the plugin from plugin list page. http://[domain]/wp-admin/plugins.php
Zip making process [Build, Localization, Version replace & Zip]
# One by one.
npm run build
npm run makepot
npm run version
npm run zip
# Single release command - which actually will run the above all in single command.
npm run release
After running release
command, there will be a folder called /dist
will be generated at the root directory with wp-bot-lite.zip
project files.
Run PHP Unit Test
composer run test
Run all tests by single command - PHPCS, PHPUnit
composer run test:all
Run Jest Unit Test
npm run test:unit
Run Jest-Pupeteer e2e Test
WordPress core doc link: https://make.wordpress.org/core/2019/06/27/introducing-the-wordpress-e2e-tests/
Requirements:
- Must have docker installed and running by ensuring these commands -
npm run env:stop
npm run env:start
Normal e2e test
npm run test:e2e
Interactive e2e test
npm run test:e2e:watch
PHP Coding Standards - PHPCS
Get all errors of the project:
composer run phpcs
Fix all errors of the project:
composer run phpcbf
Full Composer test run:
composer run test:all
Browse Plugin
http://[domain]/wp-admin/admin.php?page=botlite#/
REST API's
REST API Documentation
-
Alert Lists
- Method:
GET
- URL: http://[domain]/wp-json/bot-lite/v1/alerts
- Method:
-
Alert Details
- Method:
GET
- URL By ID: http://[domain]/wp-json/bot-lite/v1/alerts/1
- URL By Slug: http://[domain]/wp-json/bot-lite/v1/alerts/first-alert
- Method:
-
Create Alert
- Method:
POST
- URL Webhook on TradingView: http://[domain]/wp-json/bot-lite/v1/alerts
- Body:
{ "name":"{{strategy.order.action}}", "type": "{{strategy.order.action}}", "close": "{{close}}", "interval": "{{interval}}", "exchange": "{{exchange}}", "ticker": "{{ticker}}", "time": "{{time}}", "timenow": "{{timenow}}", "contracts": "{{strategy.order.contracts}}", "position_size":"{{strategy.position_size}}" }
- Method:
-
Delete Alerts
- Method:
DELETE
- URL: http://[domain]/wp-json/bot-lite/v1/alerts
- Body:
{ "ids": [1, 2] }
- Method:
Version & Changelogs
v0.0.1 - 12/12/2022
- New Feature : Alert Create.
- New Feature : Alert Update.
- New Feature : Alert Delete.
- New Feature : Alert Status change.
- New API: City dropdown list.
- New: Updated logo icon and plugin name.
- New Components: Input Text-Editor, Improved design.
- Refactor: Refactored codebase and updated docs.
- New: Alert type seeder.
- Chore: Zip file generator.
- Chore: i18n localization generator.
Options for specific files:
Get specific file errors of the project:
vendor/bin/phpcs bot-lite.php
Fix specific file errors of the project:
vendor/bin/phpcbf bot-lite.php
Versions
Simple Version with raw PHP
Version with EsLint and i18n Setup
https://github.com/dearvn/bot-lite/releases/tag/vSimpleEslint
Version with EsLint, i18n and React Router Setup
https://github.com/dearvn/bot-lite/releases/tag/vReactRouter
Version with PostCSS and Tailwind CSS Setup
https://github.com/dearvn/bot-lite/releases/tag/vTailwindCss
Version with PHPCS setup
Version with PHP OOP Architecture
Gutenberg blocks
Inside src/blocks
you'll find gutenberg block for ready block setup -
Contribution
Contribution is open and kindly accepted. Before contributing, please check the issues tab if anything in enhancement or bug. If you want to contribute new, please create an issue first with your enhancement or feature idea. Then, fork this repository and make your Pull-Request. I'll approve, if everything goes well.
Contact
Find me at [email protected]