Starting from:
lein new foo
cd foo
Say I have a random JAR file that is not available in any repository:
touch README.md
| defmodule Stocks do | |
| def get_new_highs do | |
| HTTPoison.start | |
| resp = HTTPoison.get!("http://www.smh.com.au/business/markets/52-week-highs?page=-1",[], [proxy: "http://proxy.cat.com:80"]) | |
| data = Floki.find(resp.body, "#content section table tbody tr th a") | |
| Enum.map(data, fn({_,_,[code]}) -> code end) | |
| end | |
| end |
| from zipline.algorithm import TradingAlgorithm | |
| from zipline.transforms import MovingAverage | |
| from zipline.utils.factory import load_from_yahoo | |
| from zipline.finance.slippage import FixedSlippage | |
| from zipline.finance.commission import PerShare | |
| from datetime import datetime | |
| import matplotlib.pyplot as plt | |
| class DualMovingAverage(TradingAlgorithm): |
| (defn average [coll] | |
| (/ (reduce + coll) | |
| (count coll))) | |
| (defn ma [period coll] | |
| (lazy-cat (repeat (dec period) nil) | |
| (map average (partition period 1 coll)))) |
| (ns scratch.core | |
| (:require [clojure.core.async :as async :refer [go-loop <! chan <!! >! >!!]]) | |
| (:gen-class)) | |
| (defn make-actor | |
| "Creates actor of specific name" [name] | |
| (let [in (chan 10)] | |
| (go-loop [[msg-type sender msg-body :as data] (<! in)] | |
| (when data | |
| (println (str "Actor " name " got message " msg-type |
| import dxfgrabber | |
| dxf = dxfgrabber.readfile('surface0.dxf') | |
| all_surface_entities = [entity for entity in dxf.entities if entity.layer == '0'] | |
| all_progress_line_entities = [entity for entity in dxf.entities if entity.layer == 'Progress Line'] | |
| f = open('surface_points.csv', 'w') | |
| # List of Point objects | |
| for p in all_surface_entities: |
| from pandas import * | |
| import pandas.io.data as web | |
| import datetime | |
| start = datetime.datetime(2010, 1, 1) | |
| end = datetime.datetime(2014, 8, 15) | |
| # Get daily price data | |
| ctx = web.DataReader('ctx.ax', 'yahoo', start, end) |
| (ns scraping.core | |
| (:gen-class) | |
| (:import (org.jsoup Jsoup) | |
| (org.jsoup.select Elements) | |
| (org.jsoup.nodes Element))) | |
| (def URL "http://www.smh.com.au/business/markets/52-week-highs?page=-1") | |
| (defn get-page [] | |
| (.get (Jsoup/connect URL))) |
| import org.jsoup.Jsoup | |
| import org.jsoup.nodes.Element | |
| import scala.collection.JavaConversions._ | |
| System.setProperty("http.proxyHost", "xxx.xxx.xxx") | |
| val doc = Jsoup.connect("http://www.smh.com.au/business/markets/52-week-highs?page=-1").get() | |
| //doc.body() | |
| val elems = doc.select("#content > section > table > tbody > tr > th > a") | |
| val foo = for ( e <- elems) yield e.text |
This is my recommended path for learning Haskell.
http://www.seas.upenn.edu/~cis194/lectures.html Brent Yorgey's course is the best I've found so far and replaces both Yann Esposito's HF&H and the NICTA course. This course is particularly valuable as it will not only equip you to write Haskell but also help you understand parser combinators.