     let date: NSDate
 }
 
-struct FXResult<M: MoneyType>: FXResultType {
+struct FXTransaction<M: MoneyType>: FXTransactionType {
     let money: M
 
     init(money: M) {


// MARK: - FX Providers

struct Providers { }

// MARK: - Yahoo

extension Providers {

    struct Yahoo: FXProviderType {
        typealias RequestType = NSURLSessionDataTask

        let name = "Yahoo"

        func quote(ticker: String, completion: FXQuote -> Void) -> NSURLSessionDataTask {
            guard let url = NSURL(string: "http://download.finance.yahoo.com/d/quotes.csv?s=\(ticker)=X&f=nl1d1t1") else {
                fatalError("Unable to construct URL for Yahoo Finance API")
            }

            let request = NSURLRequest(URL: url)
            let session = NSURLSession(configuration: NSURLSessionConfiguration.defaultSessionConfiguration())
            let task = session.dataTaskWithRequest(request) { data, response, error in
                // Result is a string like this:
                // "GBP/EUR",1.3994,"11/2/2015","4:51pm"

                // To start with, split by comma
                if let data = data, str = String(data: data, encoding: NSUTF8StringEncoding) {
                    let components = str.componentsSeparatedByString(",")
                    if components.endIndex >= 1, let rate = Double(components[1]) {
                        completion(FXQuote(ticker: ticker, rate: BankersDecimal(floatLiteral: rate), date: NSDate()))
                    }
                }
            }
            return task
        }
    }
}




//

import Foundation
import Result

// MARK: - Protocol: Quote Type

protocol FXQuoteType {
    var ticker: String { get }
