Corporate Actions
Get Stock Splits
import Dinari from '@dinari/api-sdk';
const client = new Dinari({
apiKeyID: process.env['DINARI_API_KEY_ID'], // This is the default and can be omitted
apiSecretKey: process.env['DINARI_API_SECRET_KEY'], // This is the default and can be omitted
environment: 'sandbox', // defaults to 'production'
});
async function main() {
const stockID = 'stock-id-here';
const splits = await client.v2.marketData.stocks.splits.listForStock(stockID, {
page: 1,
page_size: 10,
});
console.log(splits);
}
main();
import os
from dinari_api_sdk import Dinari
client = Dinari(
api_key_id=os.environ.get("DINARI_API_KEY_ID"), # This is the default and can be omitted
api_secret_key=os.environ.get("DINARI_API_SECRET_KEY"), # This is the default and can be omitted
environment="sandbox", # defaults to "production"
)
splits = client.v2.market_data.stocks.splits.list_for_stock(
stock_id="stock_xxx", # Replace with the actual Stock ID
page=1,
page_size=25,
)
package main
import (
"context"
"fmt"
"log"
dinari "github.com/dinaricrypto/dinari-api-sdk-go"
"github.com/dinaricrypto/dinari-api-sdk-go/option"
)
func main() {
// DINARI_API_KEY_ID and DINARI_API_SECRET_KEY are set as environment variables
client := dinari.NewClient(
option.WithEnvironmentSandbox(), // Defaults to production when omitted
)
stockID := "target-stock-uuid"
queryParams := dinari.V2MarketDataStockSplitListForStockParams{
Page: dinari.Int(1),
PageSize: dinari.Int(10),
}
stockSplits, err := client.V2.MarketData.Stocks.Splits.ListForStock(context.TODO(), stockID, queryParams)
if err != nil {
log.Fatalf("Failed to get stock splits: %v", err)
}
fmt.Printf("Stock Splits: %+v\\n", stockSplits)
}
Get Stock Dividends
import Dinari from '@dinari/api-sdk';
const client = new Dinari({
apiKeyID: process.env['DINARI_API_KEY_ID'], // This is the default and can be omitted
apiSecretKey: process.env['DINARI_API_SECRET_KEY'], // This is the default and can be omitted
environment: 'sandbox', // defaults to 'production'
});
async function main() {
const stockID = 'stock-id-here';
const dividends = await client.v2.marketData.stocks.retrieveDividends(stockID);
console.log(dividends);
}
main();
import os
from dinari_api_sdk import Dinari
client = Dinari(
api_key_id=os.environ.get("DINARI_API_KEY_ID"), # This is the default and can be omitted
api_secret_key=os.environ.get("DINARI_API_SECRET_KEY"), # This is the default and can be omitted
environment="sandbox", # defaults to "production"
)
dividends = client.v2.market_data.stocks.retrieve_dividends(
stock_id="stock_xxx" # Replace with the actual Stock ID
)
package main
import (
"context"
"fmt"
"log"
dinari "github.com/dinaricrypto/dinari-api-sdk-go"
"github.com/dinaricrypto/dinari-api-sdk-go/option"
)
func main() {
// DINARI_API_KEY_ID and DINARI_API_SECRET_KEY are set as environment variables
client := dinari.NewClient(
option.WithEnvironmentSandbox(), // Defaults to production when omitted
)
stockID := "target-stock-uuid"
dividends, err := client.V2.MarketData.Stocks.GetDividends(context.TODO(), stockID)
if err != nil {
log.Fatalf("Failed to get stock dividends: %v", err)
}
fmt.Printf("Dividends: %+v\\n", dividends)
}
Updated 14 days ago