I recently built GoKSEI, a Go client library for accessing Indonesian investment data from AKSES-KSEI. What started as a simple weekend project to check my portfolio programmatically has grown into something more useful than I expected.
The Problem
Like many Indonesian investors, I wanted to track my portfolio without manually logging into AKSES-KSEI every time. The official web interface is functional, but not great for automation or building tools on top of. I needed a way to programmatically access my investment data for personal tracking and analysis.
What GoKSEI Does
GoKSEI is an unofficial Go client library that lets you retrieve your portfolio data from AKSES-KSEI (the Indonesian Central Securities Depository). It handles authentication, session management, and data parsing so you can focus on what you want to do with the data.
The library supports:
- Portfolio balances - Current holdings across all your accounts
- Multiple investment types - Stocks (saham), bonds (obligasi), and mutual funds (reksadana)
- Multiple accounts - Each individual investor in Indonesia have their own KSEI Account, and each accounts hold investment data from all accounts under your legal name. Using GoKSEI step this up further, you can consolidate data from multiple individuals such as your husband/wife.
Technical Implementation
Building this was an interesting reverse engineering exercise. AKSES-KSEI's web interface uses a mix of form submissions and XHR calls, so I had to:
- Analyze the authentication flow - Figure out how login sessions work
- Map the API endpoints - Identify which URLs return which data
- Parse the responses - Convert HTML tables and JSON responses into structured Go types
- Handle edge cases - Deal with timeouts, rate limiting, and session expiration
The library is designed to be simple to use:
import "github.com/chickenzord/goksei"
func main()
Real-World Applications
I've already put GoKSEI to work in a few projects:
KSEI Exporter - A Prometheus exporter that tracks portfolio metrics over time. Now I can monitor my investment performance alongside my other self-hosted services to see how it performs over time.
Update: I recently built PortoSync, a Model Context Protocol (MCP) server that uses GoKSEI to connect Indonesian investment portfolio data directly to AI assistants like Claude. Now I can ask questions like "Show me my current holdings" and get real-time data through natural language.
The library makes it easy to build custom tools for Indonesian investors who want more control over their data.
Challenges and Learnings
The trickiest part was reverse engineering the authentication flow. AKSES-KSEI has changed their authentication mechanism at least once since I started working on this, requiring me to update the library accordingly. Since this is an unofficial client, there's no guarantee it will always work if they decide to change their systems again.
I also learned a lot about Indonesian financial data formats and conventions. Different investment types return data in slightly different structures, so the library needed to handle these variations gracefully.
Open Source Approach
I decided to open source GoKSEI because the Indonesian fintech ecosystem could use more programmatic access to investment data. While there are commercial APIs available, having an open source option gives individual developers and small projects more flexibility.
The library is available on GitHub under MIT license. I've tried to document it well and include examples for common use cases.
What's Next
I'm planning to add support for more data types and improve error handling based on real-world usage. If you're building tools that need Indonesian investment data, give GoKSEI a try and let me know how it works for you.
Keep in mind that since this is an unofficial client, it may break if AKSES-KSEI changes their systems. I'll do my best to keep it updated, but there's always that risk with reverse-engineered APIs.
The goal is to make it easier for Indonesian developers to build financial tools and services. Sometimes the best way to get the API you want is to build it yourself.