Skip to content

icebert04/OptionsAI-Trader-NLP

Repository files navigation

NLP Analyzer for Algorithmic Traders

This Python script is designed for algorithmic traders, particularly those involved in options and derivatives trading, to perform Natural Language Processing (NLP) analysis on textual data, such as PDF reports and text input. It offers insights into trading events, sentiment, risk assessment, named entity recognition, volatility, and mergers and acquisitions information.

Features

  • Event Detection: Detect trading events such as earnings reports, interest rate changes, options activity, and more.

  • Sentiment Analysis: Analyze text sentiment and categorize it as Positive, Negative, or Neutral for market sentiment evaluation.

  • Risk Assessment: Evaluate the risk level of the text based on keywords related to trading risks.

  • Named Entity Recognition (NER): Recognize entities (e.g., organizations, cardinal numbers) and associate them with relevant sentences.

  • Volatility Analysis: Identify sentences mentioning "volatility" to monitor market volatility.

  • Mergers and Acquisitions (M&A) Detection: Detect sentences related to mergers and acquisitions for market insights.

Getting Started

  1. Clone this repository to your local machine.
  2. Install required dependencies using pip install -r requirements.txt.
  3. Run the Flask app using python nlp_analyzer.py.

Usage

To use the NLP Analyzer, make a POST request to the /api/analyze endpoint. You can provide text data directly or upload a PDF for analysis.

Example API Request:

import requests

url = 'http:https://localhost:5000/api/analyze'

data = {
    'text': 'Insert your text here.'
}

files = {'file': ('report.pdf', open('report.pdf', 'rb'))}

response = requests.post(url, data=data, files=files)

print(response.json())

The script returns results for event detection, sentiment analysis, risk assessment, NER analysis, volatility mentions, and M&A information.

Configuration Customize event keywords and related terms by modifying the event_keywords_and_related dictionary in the script.

event_keywords_and_related = {
    "earnings report": ["financial report", "earnings statement"],
    "interest rate": ["rate change", "Fed policy"],
    # Add more event keywords and related terms here
}

Frontend

  • Next.js
  • Axios
  • React

Backend

  • Flask
  • Vader
  • Spacy
  • PyPDF2

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

This project relies on various Python libraries for NLP, PDF processing, and sentiment analysis.

Contact Information

If you have any questions or suggestions, feel free to contact me.

Happy trading

About

This Python script is designed for algorithmic traders

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published