Skip to content

Instantly share code, notes, and snippets.

Avatar

Trevor Thackston ttt733

View GitHub Profile
@ttt733
ttt733 / AlpacaForGoogleSheets.gs
Created Feb 14, 2020
Alpaca for Google Sheets - Sample Script
View AlpacaForGoogleSheets.gs
var PositionRowStart = 17;
// Submit a request to the Alpaca API
function _request(path,params,data) {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Account & Portfolio")
var isPaper = sheet.getRange("E3").getValue()
var apiKey = sheet.getRange("E4").getValue()
var apiSecret = sheet.getRange("E5").getValue()
if (!apiKey || !apiSecret) {
@ttt733
ttt733 / ShortProgram.cs
Created Jul 23, 2019
Shorting with the Alpaca API in C#
View ShortProgram.cs
using Alpaca.Markets;
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
// With the Alpaca API, you can open a short position by submitting a sell
// order for a security that you have no open long position with.
namespace ShortingExample
@ttt733
ttt733 / short_orders.py
Last active Jul 15, 2019
Shorting with the Alpaca API
View short_orders.py
import alpaca_trade_api as tradeapi
import time
if __name__ == '__main__':
"""
With the Alpaca API, you can open a short position by submitting a sell
order for a security that you have no open long position with.
"""
# First, open the API connection
@ttt733
ttt733 / MeanReversionPaperOnly.cs
Last active Sep 29, 2020
Mean Reversion Trading Algorithm (Alpaca)
View MeanReversionPaperOnly.cs
using Alpaca.Markets;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
namespace Examples
{
class MeanReversionPaperOnly
{
You can’t perform that action at this time.