It will listen to Twitter signals from:
"SwingBot Large Caps" (@r_scalp)
"SwingBot Small Caps" (@SwingBot_Small)
And will execute all signals as paper trades on:
Alpaca Stock Brokerage (www.alpaca.markets)
DISCLAIMER: This software is provided AS IS. It is not responsible for any financial loss or gain. (Unless you win big, then I'll accept a Tesla, Ludicrous+ Mode only...with Warp Speed of course)
Once you clone this repository run: npm install
to install all dependencies
Once dependencies are installed run: npm start
in your terminal
- Twitter Developer Account: https://developer.twitter.com/
- Alpaca Account: https://www.alpaca.markets
- consumer_api_key
- consumer_api_secret
- access_token_key
- access_token_secret
- keyId
- secretKey
IF YOU RESET YOUR ALPACA PAPER TRADING ACCOUNT YOU WILL NEED TO RE-GENERATE YOUR KEYS OR THE APP WILL NOT WORK
Once you have all credentials open the src/settings.ts
file and add your credentials:
{
twitter: {
api: {
consumer_key: '--- TWITTER CONSUMER API KEY HERE ---',
consumer_secret: '--- TWITTER CONSUMER API SECRET HERE ---',
access_token_key: '--- TWITTER AUTHENTICATION ACCESS TOKEN KEY HERE ---',
access_token_secret: '--- TWITTER AUTHENTICATION ACCESS TOKEN SECRET HERE --- ',
}
},
alpaca: {
api: {
keyId: '--- ALPACA API KEY HERE ---',
secretKey: '--- ALPACA SECRET KEY HERE ---',
}
}
}
If you only want to listen to signals from (@r_scalp) or (@SwingBot_Small) individually (but not both) just comment out the user in the followUsers
property in the src/settings.ts
file.
This setup will only follow (and trade) "SwingBot Large Caps" (@r_scalp):
{
twitter: {
followUsers: [
{ name: "@r_scalp", id: "1379234944652697600" },
// { name: "@SwingBot_Small", id: "1388217130709962753" },
]
}
}
You can follow yourself as well. This is good for testing and making sure the twitter stream is set up and working. If you add yourself and tweet something, you should see your tweet show up in the terminal. To add yourself:
{
twitter: {
followUsers: [
{ name: "@r_scalp", id: "1379234944652697600" },
{ name: "@SwingBot_Small", id: "1388217130709962753" },
{ name: "@my-twitter-handle", id: "my-id-number" },
]
}
}
HOW TO GET YOUR TWITTER ID: To get your Twitter ID # go to: https://www.codeofaninja.com/tools/find-twitter-id/
Currently, the only authorized signals are from twitter users (@r_scalp) and (@SwingBot_Small). That is evident in the src/settings.ts
file:
{
twitter: {
authorizedSignalsFromUsers: ['@r_scalp', '@SwingBot_Small']
}
}
You can add yourself to that list (but you also must add yourself to the followUsers
list as well). Such as:
{
twitter: {
followUsers: [
{ name: "@r_scalp", id: "1379234944652697600" },
{ name: "@SwingBot_Small", id: "1388217130709962753" },
{ name: "@my-twitter-handle", id: "my-id-number" },
],
authorizedSignalsFromUsers: ['@r_scalp', '@SwingBot_Small', '@my-twitter-handle']
}
}
Then, as long as you follow the Tweet format from (@r_scalp) and (@SwingBot_Small) you can tweet out:
Now Buying: $CCL at ~$29.51
Exit Target: $29.96 (Profit: $X.XX (x.xx%))
Stop Loss: $28.92
and the engine will execute your paper trade. This is great for testing and making sure the system is working properly.
NOTE: You can test and execute trades on Alpaca even when markets are closed. The trade will show up in the order history as
accepted/held
and wont be executed until the markets open. You can always go in any time and cancel it yourself manually.
There are a couple of quick tests at the bottom of the src/index.ts
file that are commented out. You can uncomment them and run them individually to test that the system is working properly. All credentials must be added to the src/settings.ts
file before any tests can run.