Simple data generator application, publishing stock data to Kinesis or Kafka Data Stream. This data generator is used by some of the examples in this repository.
Requires boto3 and kafka-python-ng.
kafka-python-ngis used instead ofkafka-pythonbecausekafka-pythonhas not been updated for Python 3.8 and above.
Install the required dependencies with the following command:
python -m pip install -r requirements.txtpython stock.py <stream_name>
If not stream name is specified, ExampleInputStream will be used.
python stock_kafka.py <topic_name> <bootstrap_server>
If no topic name is specified, StockInputTopic will be used.
If no bootstrap server is specified, localhost:9092 will be used.
{'event_time': '2024-05-28T19:53:17.497201', 'ticker': 'AMZN', 'price': 42.88}