0

I hope this is the correct place. I am an amateur programmer and attempting to build a portfolio manager-type program on the Stellar Network. Right now I'm trying to call and parse Stellar network orderbooks using offers() in the 'Address' class of py-stellar-base. I'm not actually sure what the correct syntax looks like- is there like a 'genesis' stellar address where everything was initially mined? If so is this the address I should use in the API call? If anyone has done this before I'd love to read and learn. Open to any and all wisdom on the matter.

1

I'm not 100% sure if I understood you correctly, but you may be mixing up two concepts:

The offers within the Address class are giving you the offers that one Account has made, regardless of the actual asset (the naming is a bit off in the sdk, as an Address is pointing to an Account, in this case it's the same).

Example:

Account X wants to buy 10 Gold for 10 XLM and wants to sell 10 TokenX for 30 XLM.

In other words: Offers are a 1:n Relationship of an Account to Offers (which in turn can be buy and sell).

An Orderbook is a 1:n relationship of an Asset (e.g. XLM as native Asset) to another one (a concept called Currency Pairs). Offers again can be sell and buy.

The Orderbook is therefore living on the Horizon class.

Here's an example on the testnetwork, that checks the orderbook for DSQ (the native token of DSTOQ) against D5BK (a real estate fund):

data = dict(
    buying_asset_code='DSQ',
    buying_asset_issuer='GBDQPTQJDATT7Z7EO4COS4IMYXH44RDLLI6N6WIL5BZABGMUOVMLWMQF',
    selling_asset_code='D5BK',
    selling_asset_issuer='GBPNPZFTOXZWYYKFHSUZRLWKBTBVGSTM5C7UMUEICVEAVKBXKSCZNRIC'
)

order_book = Horizon().order_book(**data)

Here's a graphical representation of that call (scroll down to the orderbook):

https://stellar.expert/explorer/testnet/asset/D5BK-GBPNPZFTOXZWYYKFHSUZRLWKBTBVGSTM5C7UMUEICVEAVKBXKSCZNRIC?filter=orderbook&pair=DSQ-GBDQPTQJDATT7Z7EO4COS4IMYXH44RDLLI6N6WIL5BZABGMUOVMLWMQF-1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.