Skip to content

Commit 88724d1

Browse files
committed
Resolved conflicts between repositories
The conflicts required for merging have been resolved, but the branch is by no means ready for main.
1 parent 2508e4d commit 88724d1

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

soltrade/trading.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ def perform_analysis():
3939
# Creates DataFrame for manipulation
4040
columns = ['close', 'high', 'low', 'open', 'time']
4141
df = pd.DataFrame(candle_dict, columns=columns)
42-
df['time'] = pd.to_datetime(df['time'], unit='s')
43-
42+
df['time'] = pd.to_datetime(df['time'], unit='s')
4443
df = strategy(df)
4544
print(df.tail(2))
4645

@@ -98,14 +97,29 @@ def perform_analysis():
9897

9998
# Check Strategy
10099
if df['exit'].iloc[-1] == 1:
101-
exit_msg = f"Soltrade has detected a sell signal for {input_amount} ${config().secondary_mint_symbol}.."
100+
exit_msg = f"Soltrade has detected a sell signal for {input_amount} ${config().secondary_mint_symbol}."
102101
log_transaction.info(exit_msg)
103102
# log_transaction.info(get_statistics())
104103
asyncio.run(perform_swap(input_amount, config().secondary_mint))
105104
stoploss = takeprofit = 0
106105
df['entry_price'] = None
107106

107+
# This starts the trading function on a timer
108+
def start_trading():
109+
log_general.info("Soltrade has now initialized the trading algorithm.")
108110
trading_sched = BlockingScheduler()
109111
trading_sched.add_job(perform_analysis, 'interval', seconds=config().price_update_seconds, max_instances=1)
110112
trading_sched.start()
111-
perform_analysis()
113+
perform_analysis()
114+
115+
# Function to save DataFrame to JSON file
116+
def save_dataframe_to_json(df, file_path):
117+
df_json = df.to_json(orient='records')
118+
with open(file_path, 'w') as f:
119+
json.dump(df_json, f)
120+
121+
# Function to read DataFrame from JSON file
122+
def read_dataframe_from_json(file_path):
123+
with open(file_path, 'r') as f:
124+
df_json = json.load(f)
125+
return pd.read_json(df_json)

0 commit comments

Comments
 (0)