on Algorithmic Trading
Python & Historical Tick Data
Dr. Yves J. Hilpisch | The Python Quants GmbH
Online, 24. October 2017
| # This script will fetch the notifier data from unstructured CSV data | |
| # and convert that into structured and store the same into MongoDB | |
| # This converted structured data is used to visualize in charts | |
| import pdb | |
| import os | |
| import csv | |
| import pandas as pd | |
| import numpy as np | |
| from datetime import datetime |
| import argparse | |
| import sys | |
| import tempfile | |
| from time import time | |
| import random | |
| from os import listdir | |
| from os.path import isfile, join | |
| import pandas |
| """ | |
| 1. Launch Kafka: | |
| - $KAFKA_HOME/bin/zookeeper-server-start.sh $KAFKA_HOME/config/zookeeper.properties | |
| - $KAFKA_HOME/bin/kafka-server-start.sh $KAFKA_HOME/config/server.properties | |
| run via faust -A <filename> worker -l info | |
| 2. Faust library: | |
| faust.App.agent: - main processing actor in Faust App | |
| """ |
| <?php | |
| /** | |
| * Encrypts a string using Rijndael with a 256-bit (32 character) salt. | |
| * | |
| * @param string $text The text to encrypt. | |
| * @param string $key The encryption key to use. | |
| * @param string $iv The optional initialization vector to use. | |
| * | |
| * @return string Base64 encoded encrypted text. | |
| */ |
| import twitter | |
| # initialize api instance | |
| twitter_api = twitter.Api(consumer_key='YOUR_CONSUMER_KEY', | |
| consumer_secret='YOUR_CONSUMER_SECRET', | |
| access_token_key='YOUR_ACCESS_TOKEN_KEY', | |
| access_token_secret='YOUR_ACCESS_TOKEN_SECRET') | |
| # test authentication | |
| print(twitter_api.VerifyCredentials()) |
| from functools import wraps | |
| from flask import Flask, g, session, request, abort, jsonify | |
| from flask_migrate import MigrateCommand, Migrate | |
| from flask_script import Manager | |
| from flask_sqlalchemy import SQLAlchemy | |
| flask_app = Flask(__name__, static_folder='./static') | |
| db = SQLAlchemy() | |
| migrate = Migrate() |
| static var httpClient = new HttpClient(); | |
| Future<File> _downloadFile(String url, String filename) async { | |
| var request = await httpClient.getUrl(Uri.parse(url)); | |
| var response = await request.close(); | |
| var bytes = await consolidateHttpClientResponseBytes(response); | |
| String dir = (await getApplicationDocumentsDirectory()).path; | |
| File file = new File('$dir/$filename'); | |
| await file.writeAsBytes(bytes); | |
| return file; | |
| } |