Inventory Query
Inventories
Input Parameters
| Parameter | Type | Description |
|---|---|---|
| account | Account | Account |
Result Return
| Parameter | Type | Description |
|---|---|---|
| IsSuccess | bool | Whether successful |
| Data | *[]Inventory | Returns inventory list |
| Message | *string | Returns error message when IsSuccess = false |
Inventory Information Inventory Fields
Return type : Object
| Parameter | Type | Description |
|---|---|---|
| Date | *string | Transaction Date |
| Account | *string | Account |
| BranchNo | *string | Branch Code |
| StockNo | *string | Stock Symbol |
| OrderType | OrderType | Order Type: OrderTypeStock Common, OrderTypeMargin Margin, OrderTypeShort Short Sell, OrderTypeDayTrade Day Trade, OrderTypeSbl SBL |
| LastdayQty | *int64 | Previous Day Inventory Balance |
| BuyQty | *int64 | Today's Buy Quantity |
| BuyFilledQty | *int64 | Today's Buy Filled Quantity |
| BuyValue | *int64 | Buy Amount |
| TodayQty | *int64 | Today's Inventory Balance |
| TradableQty | *int64 | Tradable Quantity |
| SellQty | *int64 | Today's Sell Quantity |
| SellFilledQty | *int64 | Today's Sell Filled Quantity |
| SellValue | *int64 | Sell Amount |
| Odd | *InventoryOdd | Odd Lot Inventory Info |
| >> LastdayQty | *int64 | Previous Day Inventory Balance |
| >> BuyQty | *int64 | Today's Buy Quantity |
| >> BuyFilledQty | *int64 | Today's Buy Filled Quantity |
| >> BuyValue | *int64 | Buy Amount |
| >> TodayQty | *int64 | Today's Inventory Balance |
| >> TradableQty | *int64 | Tradable Quantity |
| >> SellQty | *int64 | Today's Sell Quantity |
| >> SellFilledQty | *int64 | Today's Sell Filled Quantity |
| >> SellValue | *int64 | Sell Amount |
Request Example
package main
import (
"fmt"
"fubon"
)
func main() {
// Initialize SDK and login
sdk := fubon.NewSDK()
// ... Login, connection, and other initialization steps ...
// Query Inventory
inventories, err := sdk.Accounting.Inventories(account)
// Error Handling
if err != nil {
fmt.Printf("❌ Inventories Error: %v (Type: %T)\n", err, err)
return
}
// Check Success
if !inventories.IsSuccess {
message := "No message"
if inventories.Message != nil {
message = *inventories.Message
}
fmt.Printf("Inventories query failed. Message: %s\n", message)
return
}
// Output Inventory List
if inventories.Data != nil && len(*inventories.Data) > 0 {
fmt.Printf("✅ Found %d inventory items\n", len(*inventories.Data))
for i, inv := range *inventories.Data {
fmt.Printf("\n=== Inventory %d ===\n", i+1)
fmt.Printf("StockNo: %s\n", *inv.StockNo)
fmt.Printf("OrderType: %v\n", inv.OrderType)
fmt.Printf("Previous Qty: %d\n", *inv.LastdayQty)
fmt.Printf("Today Qty: %d\n", *inv.TodayQty)
fmt.Printf("Tradable Qty: %d\n", *inv.TradableQty)
fmt.Printf("Today Buy: %d (Filled: %d)\n", *inv.BuyQty, *inv.BuyFilledQty)
fmt.Printf("Today Sell: %d (Filled: %d)\n", *inv.SellQty, *inv.SellFilledQty)
// Odd Lot Info
if inv.Odd != nil {
fmt.Printf("\n Odd Lot Inventory:\n")
fmt.Printf(" Today Odd Qty: %d\n", *inv.Odd.TodayQty)
fmt.Printf(" Tradable Odd Qty: %d\n", *inv.Odd.TradableQty)
}
}
} else {
fmt.Println("Inventories query succeeded but no data returned.")
}
}
Response Example
// Inventories Return Structure
Result{
IsSuccess: true,
Message: nil,
Data: &[]Inventory{
{
Date: "2023/10/13", // Transaction Date
Account: "26", // Account
BranchNo: "6460", // Branch Code
StockNo: "1101", // Stock Symbol
OrderType: OrderTypeStock, // Order Type
LastdayQty: 2000, // Previous Day Inventory Balance
BuyQty: 0, // Today's Buy Quantity
BuyFilledQty: 0, // Today's Buy Filled Quantity
BuyValue: 0, // Buy Amount
TodayQty: 2000, // Today's Inventory Balance
TradableQty: 2000, // Tradable Quantity
SellQty: 0, // Today's Sell Quantity
SellFilledQty: 0, // Today's Sell Filled Quantity
SellValue: 0, // Sell Amount
Odd: &InventoryOdd{ // Odd Lot Inventory
LastdayQty: 0,
BuyQty: 0,
BuyFilledQty: 0,
BuyValue: 0,
TodayQty: 0,
TradableQty: 0,
SellQty: 0,
SellFilledQty: 0,
SellValue: 0,
},
},
// ... more inventory items
},
}