Skip to content

Commit b880e5e

Browse files
committed
updated bot.py and readme
1 parent 2c033eb commit b880e5e

File tree

2 files changed

+36
-12
lines changed

2 files changed

+36
-12
lines changed

packages/plugin-trading/README.md

+35-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,43 @@
11
# advanced trading by moon dev
22

3-
- this plugin will include a ton of helpful trading functions so that agents can buy, sell & manage risk
4-
- while everything is currently in python i will later convert to ts
3+
- this plugin will include a ton of helpful trading functions so that agents can buy, sell & manage risk. i use these for onchain solana bots
4+
- while everything is currently in python i will later convert to ts if needed or i will add a shell (researching best approach)
55

66
how to use
7-
1. config controls the solana contract that is being traded, size, etc.
8-
2. run from ezbot, there are a bunch of different options of bots
9-
3. nice_funcs has a lot of helpful functions to enable the bot to trade
7+
1. config.py controls the solana contract that is being traded, size, etc.
8+
2. run from bot.py, there are a bunch of different 'actions' for the trading, like buy under x price, while sell over y price. or a breakout option or stop loss.
9+
3. nice_funcs has a ton of helpful functions to algo trade onchain solana
10+
4. if the ai needs ohlcv data they can get it on get_ohlcv_data.py
11+
12+
things needed in dontshare.py (add to .gitignore and never share this file)
13+
1. sketch but private solana key if you want them to trade
14+
2. birdeye api key
15+
3. rpc_url (i use helius)
16+
17+
Completed 12/21
18+
19+
1. nice_funcs.py - a ton of solana onchain infastructure to trade. ive been using this code for all my onchain bots but believe ai will utilize them better.
20+
21+
2. bot.py - a simple script to allow any ai to call actions like 0 - close a position 1- open a position 2- sell if price falls under x price (stop loss) 3- buy if price goes over y price (breakout) 5- buy if under X price and sell if over Y price (market maker)
22+
23+
3. get_ohlcv_data.py - an easy way for ai to get any ohlcv data anytime. every great trade starts with data so this is essential
24+
25+
26+
27+
28+
29+
30+
31+
32+
33+
34+
35+
36+
37+
38+
39+
1040

11-
'
1241

1342
CONVERTING FROM PYTHON TO TYPESCRIPT
1443

packages/plugin-trading/python_trading/bot.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
###### ASKING USER WHAT THEY WANNA DO - WILL REMOVE USER SOON AND REPLACE WITH BOT ######
2929
action = 0
3030
print('slow down, dont trade by hand... moon dev told you so...')
31-
action = input('0 to close, 1 to buy, 2 stop loss, 3 breakout, 4 OHLCV data, 5 market maker |||| 6 funding buy, 7 liquidation amount:')
31+
action = input('0 to close, 1 to buy, 2 stop loss, 3 breakout, 5 market maker |||| 6 funding buy, 7 liquidation amount:')
3232
print('you entered:', action)
3333
action = int(action)
3434

@@ -194,12 +194,7 @@ def bot():
194194
print(f'price is {price} and not buying or selling position is {pos_usd} and usd size is {usd_size}')
195195
time.sleep(30)
196196

197-
if action == 4:
198-
print('OHLCV data bot')
199-
df = n.get_data(symbol, DAYSBACK_4_DATA, DATA_TIMEFRAME)
200197

201-
# save df to csv here packages/plugin-trading/python_trading/ohlcv_data
202-
df.to_csv(f'packages/plugin-trading/python_trading/ohlcv_data/{symbol}.csv')
203198
while action == 5:
204199
print(f'market maker buying below {buy_under} and selling above {sell_over}')
205200

0 commit comments

Comments
 (0)