{"id":13366411,"url":"https://github.com/aclindsa/ofxGo","last_synced_at":"2025-03-12T18:30:57.325Z","repository":{"id":47410404,"uuid":"45782564","full_name":"aclindsa/ofxgo","owner":"aclindsa","description":"Golang library for querying and parsing OFX","archived":false,"fork":false,"pushed_at":"2024-04-11T01:16:42.000Z","size":388,"stargazers_count":139,"open_issues_count":0,"forks_count":27,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-10-25T05:22:29.912Z","etag":null,"topics":["banking","client","finance","go","golang","hacktoberfest","ofx","parser","parsing","sgml","xml"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aclindsa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-08T13:56:53.000Z","updated_at":"2024-09-12T18:39:25.000Z","dependencies_parsed_at":"2024-01-08T15:02:46.214Z","dependency_job_id":"2bd2c836-42ee-4e01-abb9-d1a820ecf686","html_url":"https://github.com/aclindsa/ofxgo","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aclindsa%2Fofxgo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aclindsa%2Fofxgo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aclindsa%2Fofxgo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aclindsa%2Fofxgo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aclindsa","download_url":"https://codeload.github.com/aclindsa/ofxgo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243271161,"owners_count":20264402,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["banking","client","finance","go","golang","hacktoberfest","ofx","parser","parsing","sgml","xml"],"created_at":"2024-07-30T00:01:24.385Z","updated_at":"2025-03-12T18:30:56.985Z","avatar_url":"https://github.com/aclindsa.png","language":"Go","funding_links":[],"categories":["财经","財經"],"sub_categories":["高级控制台界面","高級控制台界面"],"readme":"# OFXGo\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/aclindsa/ofxgo)](https://goreportcard.com/report/github.com/aclindsa/ofxgo)\n[![Build Status](https://github.com/aclindsa/ofxgo/workflows/ofxgo%20CI%20Test/badge.svg?branch=master)](https://github.com/aclindsa/ofxgo/actions?query=workflow%3A%22ofxgo+CI+Test%22+branch%3Amaster)\n[![Coverage Status](https://coveralls.io/repos/github/aclindsa/ofxgo/badge.svg?branch=master)](https://coveralls.io/github/aclindsa/ofxgo?branch=master)\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/aclindsa?ofxgo)](https://pkg.go.dev/github.com/aclindsa/ofxgo)\n\n**OFXGo** is a library for querying OFX servers and/or parsing the responses. It\nalso provides an example command-line client to demonstrate the use of the\nlibrary.\n\n## Goals\n\nThe main purpose of this project is to provide a library to make it easier to\nquery financial information with OFX from the comfort of Golang, without having\nto marshal/unmarshal to SGML or XML. The library does _not_ intend to abstract\naway all of the details of the OFX specification, which would be difficult to do\nwell. Instead, it exposes the OFX SGML/XML hierarchy as structs which mostly\nresemble it. Its primary goal is to enable the creation of other personal\nfinance software in Go (as it was created to allow me to fetch OFX transactions\nfor my own project, [MoneyGo](https://github.com/aclindsa/moneygo)).\n\nBecause the OFX specification is rather... 'comprehensive,' it can be difficult\nfor those unfamiliar with it to figure out where to start. To that end, I have\ncreated a sample command-line client which uses the library to do simple tasks\n(currently it does little more than list accounts and query for balances and\ntransactions). My hope is that by studying its code, new users will be able to\nfigure out how to use the library much faster than staring at the OFX\nspecification (or this library's [API\ndocumentation](https://pkg.go.dev/github.com/aclindsa/ofxgo)). The command-line client\nalso serves as an easy way for me to test/debug the library with actual\nfinancial institutions, which frequently have 'quirks' in their implementations.\nThe command-line client can be found in the [cmd/ofx\ndirectory](https://github.com/aclindsa/ofxgo/tree/master/cmd/ofx) of this\nrepository.\n\n## Library documentation\n\nDocumentation can be found with the `go doc` tool, or at\nhttps://pkg.go.dev/github.com/aclindsa/ofxgo\n\n## Example Usage\n\nThe following code snippet demonstrates how to use OFXGo to query and parse\nOFX code from a checking account, printing the balance and returned transactions:\n\n```go\nclient := ofxgo.BasicClient{} // Accept the default Client settings\n\n// These values are specific to your bank\nvar query ofxgo.Request\nquery.URL = \"https://secu.example.com/ofx\"\nquery.Signon.Org = ofxgo.String(\"SECU\")\nquery.Signon.Fid = ofxgo.String(\"1234\")\n\n// Set your username/password\nquery.Signon.UserID = ofxgo.String(\"username\")\nquery.Signon.UserPass = ofxgo.String(\"hunter2\")\n\nuid, _ := ofxgo.RandomUID() // Handle error in real code\nquery.Bank = append(query.Bank, \u0026ofxgo.StatementRequest{\n\tTrnUID: *uid,\n\tBankAcctFrom: ofxgo.BankAcct{\n\t\tBankID:   ofxgo.String(\"123456789\"),   // Possibly your routing number\n\t\tAcctID:   ofxgo.String(\"00011122233\"), // Possibly your account number\n\t\tAcctType: ofxgo.AcctTypeChecking,\n\t},\n\tInclude: true, // Include transactions (instead of only balance information)\n})\n\nresponse, _ := client.Request(\u0026query) // Handle error in real code\n\n// Was there an OFX error while processing our request?\nif response.Signon.Status.Code != 0 {\n\tmeaning, _ := response.Signon.Status.CodeMeaning()\n\tfmt.Printf(\"Nonzero signon status (%d: %s) with message: %s\\n\", response.Signon.Status.Code, meaning, response.Signon.Status.Message)\n\tos.Exit(1)\n}\n\nif len(response.Bank) \u003c 1 {\n\tfmt.Println(\"No banking messages received\")\n\tos.Exit(1)\n}\n\nif stmt, ok := response.Bank[0].(*ofxgo.StatementResponse); ok {\n\tfmt.Printf(\"Balance: %s %s (as of %s)\\n\", stmt.BalAmt, stmt.CurDef, stmt.DtAsOf)\n\tfmt.Println(\"Transactions:\")\n\tfor _, tran := range stmt.BankTranList.Transactions {\n\t\tcurrency := stmt.CurDef\n\t\tif ok, _ := tran.Currency.Valid(); ok {\n\t\t\tcurrency = tran.Currency.CurSym\n\t\t}\n\t\tfmt.Printf(\"%s %-15s %-11s %s%s%s\\n\", tran.DtPosted, tran.TrnAmt.String()+\" \"+currency.String(), tran.TrnType, tran.Name, tran.Payee.Name, tran.Memo)\n\t}\n}\n```\n\nSimilarly, if you have an OFX file available locally, you can parse it directly:\n\n```go\nfunc main() {\n\tf, err := os.Open(\"./transactions.qfx\")\n\tif err != nil {\n\t\tfmt.Printf(\"can't open file: %v\\n\", err)\n\t\treturn\n\t}\n\tdefer f.Close()\n\n\tresp, err := ofxgo.ParseResponse(f)\n\tif err != nil {\n\t\tfmt.Printf(\"can't parse response: %v\\n\", err)\n\t\treturn\n\t}\n\n\t// do something with resp (*ofxgo.Response)\n}\n```\n\n## Requirements\n\nOFXGo requires go \u003e= 1.12\n\n## Using the command-line client\n\nTo install the command-line client and test it out, you may do the following:\n\n$ go get -v github.com/aclindsa/ofxgo/cmd/ofx \u0026\u0026 go install -v github.com/aclindsa/ofxgo/cmd/ofx\n\nOnce installed (at ~/go/bin/ofx by default, if you haven't set $GOPATH), the\ncommand's usage should help you to use it (`./ofx --help` for a listing of the\navailable subcommands and their purposes, `./ofx subcommand --help` for\nindividual subcommand usage).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faclindsa%2FofxGo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faclindsa%2FofxGo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faclindsa%2FofxGo/lists"}