Skip to content

Instantly share code, notes, and snippets.

View JCBarry's full-sized avatar

Jason Barry JCBarry

  • Tradier
  • Cranston, RI
  • 16:56 (UTC -04:00)
View GitHub Profile
@JCBarry
JCBarry / change-order.php
Created January 2, 2019 18:12
Change Order (PHP)
<?php
// get cURL resource
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, 'https://api.tradier.com/v1/accounts/<ACCOUNT>/orders/<ORDER ID>');
// set method
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
@JCBarry
JCBarry / stream.js
Created December 21, 2018 17:14
Tradier Node.js Streaming Example
(function (callback) {
'use strict';
const httpTransport = require('https');
const httpOptions = {
hostname: 'stream.tradier.com',
port: '443',
path: '/v1/markets/events?symbols=AAPL&sessionid=<SESSIONID>',
method: 'GET',
headers: {
@JCBarry
JCBarry / controllers.application.js
Last active March 30, 2017 16:39
Redirect from Index
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@JCBarry
JCBarry / Main.java
Created April 29, 2015 15:05
Apex Legit CC Example
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import javax.crypto.spec.SecretKeySpec;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.jose4j.jws.AlgorithmIdentifiers;
import org.jose4j.jws.JsonWebSignature;
@JCBarry
JCBarry / TKPHPPostScript.php
Created June 1, 2012 15:41
Tradeking API POST Example using different OAuth library on Google Code
<?php
require_once 'oauth.php';
$consumer_key = '';
$consumer_secret = '';
$access_token = '';
$access_secret = '';
$consumer = new OAuthConsumer($consumer_key,$consumer_secret);
$access = new OAuthToken($access_token,$access_secret);
<FIXML xmlns="http://www.fixprotocol.org/FIXML-5-0-SP2">
<Order TmInForce="0" Typ="1" Side="1" PosEfct="O" Acct="12345678">
<Instrmt CFI="OC" SecTyp="OPT" MatDt="2012-01-27T00:00:00" StrkPx="131" Sym="SPY"/>
<OrdQty Qty="1"/>
</Order>
</FIXML>
@JCBarry
JCBarry / gist:1584804
Created January 9, 2012 20:35
XML Response for accounts/:id/holdings
<?xml version="1.0" encoding="UTF-8"?>
<response id="-198e0f1:134c3f848b9:35c3">
<accountholdings>
<holding>
<accounttype>2</accounttype>
<costbasis>0.0</costbasis>
<gainloss>0.0</gainloss>
<instrument>
<cusip>O01CVJBK4</cusip>
<desc>BAC Jan 21 2012 6.00 Call</desc>
ruby-1.9.2-p290:forever jbarry$ npm test
> forever@0.7.3 test /usr/local/lib/node_modules/forever
> vows --spec --isolate
♢ forever/spawn-options
When using forever an instance of forever.Monitor with valid options passing environment variables to env-vars.js
✓ should pass the environment variables to the child
$ forever start server.js
info: Forever processing file: server.js
{
"process": {
"pid": 82761,
"uid": 501,
"gid": 20,
"cwd": "/Users/jbarry/Projects/api-streaming",
"execPath": "/usr/local/Cellar/node/0.4.12/bin/node",
"version": "v0.4.12",
@JCBarry
JCBarry / tkapi.php
Created July 28, 2011 17:43
TradeKing API PHP OAuth Example
<?php
// This is using the PHP OAuth extenstion.
// http://www.php.net/manual/en/book.oauth.php
$consumer_key = '0cc175b9c0f1b6a831c399e269772661';
$consumer_secret = 'ff2513194e75315625628304c9eb66e8';
$access_token = '150a96573adf12b21dab621e85497e6e';
$access_secret = '5c7b57d450a71d378a5eda991f809e56';
try {