This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import alpaca_trade_api as tradeapi | |
api = tradeapi.REST(key_id=<your key id>,secret_key=<your secret key>) | |
storageLocation = "<your folder location>" | |
barTimeframe = "1H" # 1Min, 5Min, 15Min, 1H, 1D | |
assetsToDownload = ["SPY","MSFT","AAPL","NFLX"] | |
iteratorPos = 0 # Tracks position in list of symbols to download | |
assetListLen = len(assetsToDownload) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import talib | |
rawDataLocation = "<your folder location>" | |
storageLocation = "<your folder location>" | |
assetsToProcess = ["SPY"] | |
# Data types for the CSV format of the previous post | |
# ISO8601 date-time string should be read using |S24 due to its standard length |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import alpaca_trade_api as tradeapi | |
api = tradeapi.REST(key_id=<your key id>,secret_key=<your secret key>) | |
class positionHandler: | |
def __init__(self,startingBalance=10000,liveTrading=False): | |
self.cashBalance = startingBalance | |
self.livePositions = {} # Dictionary of currently open positions | |
self.openOrders = [] # List of open orders | |
self.positionHistory = [] # List of items [Symbol, new position size] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
from datetime import datetime | |
import alpaca_trade_api as tradeapi | |
api = tradeapi.REST(key_id=<your key id>,secret_key=<your secret key>) | |
backtester = positionHandler(startingBalance=10000,liveTrading=False) # Using position handler from previous article | |
backtestSymbolList = ["SPY","AAPL","BBRY"] | |
positionSizing = 0.33 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
from datetime import datetime | |
import numpy as np | |
import talib | |
import alpaca_trade_api as tradeapi | |
api = tradeapi.REST(key_id=<your key id>,secret_key=<your secret key>) | |
barTimeframe = "1H" # 1Min, 5Min, 15Min, 1H, 1D | |
assetsToDownload = ["SPY","MSFT","AAPL","NFLX"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
import numpy as np | |
import talib | |
import alpaca_trade_api as tradeapi | |
api = tradeapi.REST(key_id=<your key id>,secret_key=<your secret key>) | |
barTimeframe = "1H" # 1Min, 5Min, 15Min, 1H, 1D | |
assetsToTrade = ["SPY","MSFT","AAPL","NFLX"] | |
positionSizing = 0.25 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Configuration; | |
using Alpaca.Markets; | |
namespace example | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |