forked from Ayushpanditmoto/Trading-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
33 lines (24 loc) · 817 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Code start here
import openai
# Set up your OpenAI API key
openai.api_key = 'your-api-key'
def generate_trade_ideas(prompt):
# Use ChatGPT to generate trade ideas based on the prompt
response = openai.Completion.create(
engine="text-davinci-002",
prompt=prompt,
max_tokens=100
)
# Extract the generated text from the response
trade_idea = response.choices[0].text.strip()
return trade_idea
def main():
# Example prompt
prompt = "Generate a trade idea for AAPL stock based on recent news and technical analysis."
# Generate trade ideas using ChatGPT
trade_idea = generate_trade_ideas(prompt)
# Print the generated trade idea
print("Generated Trade Idea:")
print(trade_idea)
if __name__ == "__main__":
main()