Skip to content

Instantly share code, notes, and snippets.

View Appletone's full-sized avatar
💻
Coding

Lin Chia Hua Appletone

💻
Coding
  • Taipei, Taiwan
View GitHub Profile

https://web.archive.org/web/20110219163448/http://howtohft.wordpress.com/2011/02/15/how-to-build-a-fast-limit-order-book/

The response to my first few posts has been much larger than I’d imagined and I’d like to thank everyone for the encouragement.

If you’re interested in building a trading system I recommend first reading my previous post on general ideas to keep in mind.

My first really technical post will be on how to build a limit order book, probably the single most important component of a trading system. Because the data structure chosen to represent the limit order book will be the primary source of market information for trading models, it is important to make it both absolutely correct and extremely fast.

To give some idea of the data volumes, the Nasdaq TotalView ITCH feed, which is every event in every instrument traded on the Nasdaq, can have data rates of 20+ gigabytes/day with spikes of 3 megabytes/second or more. The individual messages average about 20 bytes each so this means handling

CKA 考試全攻略流程

前言

接下來分享,我如何一次通過考試,並且拿到90分

我是在去年 2020 Cyber Monday 特價的時候買的,連買多少錢都忘了,而且拖到快過期才去考 XD

考試是採用線上考試的方式,考生可以在家上網,找個安靜的空間就可以考試了(後面會詳細講。

@Appletone
Appletone / SwifyJSONExtension.swift
Created October 13, 2016 02:06
Magical enhanced SwiftyJSON with tree traversal
// Magical enhanced SwiftyJSON with tree traversal
/*
ex:
let a_b_c = JSONTree(root: demoJSON, keyPath: ["a", "b", "c"])
print(a_b_c.parentNode.parentNode["n"])
*/
struct JSONTree {
var root:JSON
var keyPath:[JSONSubscriptType]
@Appletone
Appletone / Array.swift
Created July 20, 2016 08:56
Array Next Element
extension Array where Element: Hashable {
func after(item: Element) -> Element? {
if let index = self.indexOf(item) where index + 1 < self.count {
return self[index + 1]
}
return nil
}
}
class MyManager {
private static let sharedInstance = MyManager()
class var sharedManager : MyManager {
return sharedInstance
}
}
var fetchedResultsProcessingOperations: [NSBlockOperation] = []
private func addFetchedResultsProcessingBlock(processingBlock:(Void)->Void) {
fetchedResultsProcessingOperations.append(NSBlockOperation(block: processingBlock))
}
func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?) {
switch type {
case .Insert:
@Appletone
Appletone / UIViewController+UIImagePickerController.swift
Last active January 13, 2016 08:32
Making UIViewController Image Pickerable
protocol ImagePickable {
var imagePicker:UIImagePickerController { get set }
func openPhotoLibrary()
}
var AssociatedObjectHandle: UInt8 = 0
extension UIViewController : ImagePickable, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
var imagePicker:UIImagePickerController {
get {
@Appletone
Appletone / protocols.md
Created January 13, 2016 07:32 — forked from rbobbins/protocols.md
Notes from "Protocol-Oriented Programming in Swift"

PS: If you liked this talk or like this concept, let's chat about iOS development at Stitch Fix! #shamelessplug

Protocol-Oriented Programming in Swift

Speaker: David Abrahams. (Tech lead for Swift standard library)

  • "Crusty" is an old-school programmer who doesn't trust IDE's, debuggers, programming fads. He's cynical, grumpy.

  • OOP has been around since the 1970's. It's not actually new.

  • Classes are Awesome

    • Encapsulation
    • Access control
// Fix for IOS 9 pop-over arrow anchor bug
// ---------------------------------------
// - IOS9 points pop-over arrows on the top left corner of the anchor view
// - It seems that the popover controller's sourceRect is not being set
// so, if it is empty CGRect(0,0,0,0), we simply set it to the source view's bounds
// which produces the same result as the IOS8 behaviour.
// - This method is to be called in the prepareForSegue method override of all
// view controllers that use a PopOver segue
//
// example use:
@Appletone
Appletone / NSManagedObject.swift
Created January 7, 2016 14:04
Create a new NSManagedObject with init method (Xcode 7.2 Swift 2.1 ) from: http://stackoverflow.com/a/33583941
extension NSManagedObject {
// Returns the unqualified class name, i.e. the last component.
// Can be overridden in a subclass.
class func entityName() -> String {
return String(self)
}
convenience init(context: NSManagedObjectContext) {
let eName = self.dynamicType.entityName()