matthewgilbert / pdblp

pandas wrapper for Bloomberg Open API
MIT License
241 stars 67 forks source link

Supply chain data (SPLC) History #84

Open fluorescent89 opened 4 years ago

fluorescent89 commented 4 years ago

Code Sample, a copy-pastable example if possible

Hello,

I am using pdblp package to gather supply chain data. But I am facing two problems. First, it just gives me the just first five suppliers of current date, not even all. Also, it does not give any historical data. By changing any date, still get the same results. I searched all web, there is no manual of tutorial for gathering supply chain data from Bloomberg. So, I was wondering if anybody has any experience or solution for this. Thank you so much!

The following shows my codes which I used : con.bulkref_hist() and con.bulkref()


import pdblp
con = pdblp.BCon(debug=True, port=8194, timeout=100000)
con.start()
con.bulkref('AAPL US Equity', 'SUPPLY_CHAIN_SUPPLIERS',ovrds=[('DZ414',"20100626")])

# Your code here, this should be a minimal reproducible example, see https://stackoverflow.com/help/mcve
pdblp.pdblp:INFO:Sending Request:
ReferenceDataRequest = {
    securities[] = {
        "AAPL US Equity"
    }
    fields[] = {
        "SUPPLY_CHAIN_SUPPLIERS"
    }
    overrides[] = {
        overrides = {
            fieldId = "DZ414"
            value = "20100626"
        }
    }
}

pdblp.pdblp:INFO:Event Type: 'RESPONSE'
pdblp.pdblp:INFO:Message Received:
ReferenceDataResponse = {
    securityData[] = {
        securityData = {
            security = "AAPL US Equity"
            eidData[] = {
            }
            fieldExceptions[] = {
            }
            sequenceNumber = 0
            fieldData = {
                SUPPLY_CHAIN_SUPPLIERS[] = {
                    SUPPLY_CHAIN_SUPPLIERS = {
                        Equity Ticker = "2317 TT Equity"
                    }
                    SUPPLY_CHAIN_SUPPLIERS = {
                        Equity Ticker = "4938 TT Equity"
                    }
                    SUPPLY_CHAIN_SUPPLIERS = {
                        Equity Ticker = "2382 TT Equity"
                    }
                    SUPPLY_CHAIN_SUPPLIERS = {
                        Equity Ticker = "601138 CH Equity"
                    }
                    SUPPLY_CHAIN_SUPPLIERS = {
                        Equity Ticker = "2330 TT Equity"
                    }
                }
            }
        }
    }
}

dates = ["20100626"]
con.bulkref_hist("AAPL US Equity", ["DZ405"],dates)

pdblp.pdblp:INFO:Sending Request:
ReferenceDataRequest = {
    securities[] = {
        "AAPL US Equity"
    }
    fields[] = {
        "DZ405"
    }
    overrides[] = {
        overrides = {
            fieldId = "REFERENCE_DATE"
            value = "20100626"
        }
    }
}

pdblp.pdblp:INFO:Event Type: 'RESPONSE'
pdblp.pdblp:INFO:Message Received:
ReferenceDataResponse = {
    securityData[] = {
        securityData = {
            security = "AAPL US Equity"
            eidData[] = {
            }
            fieldExceptions[] = {
            }
            sequenceNumber = 0
            fieldData = {
                DZ405[] = {
                    DZ405 = {
                        Equity Ticker = "2317 TT Equity"
                    }
                    DZ405 = {
                        Equity Ticker = "4938 TT Equity"
                    }
                    DZ405 = {
                        Equity Ticker = "2382 TT Equity"
                    }
                    DZ405 = {
                        Equity Ticker = "601138 CH Equity"
                    }
                    DZ405 = {
                        Equity Ticker = "2330 TT Equity"
                    }
                }
            }
        }
    }
}

#### Expected Output
date | ticker | field | name | value | position
-- | -- | -- | -- | -- | --
20100626 | AAPL US Equity | DZ405 | Equity Ticker | 2317 TT Equity | 0
20100626 | AAPL US Equity | DZ405 | Equity Ticker | 4938 TT Equity | 1
20100626 | AAPL US Equity | DZ405 | Equity Ticker | 2382 TT Equity | 2
20100626 | AAPL US Equity | DZ405 | Equity Ticker | 601138 CH Equity | 3
20100626 | AAPL US Equity | DZ405 | Equity Ticker | 2330 TT Equity | 4

#### Version Information

[paste the output of ``pdblp.__version__`` here below this line]
matthewgilbert commented 4 years ago

I personally have not used this so cannot comment, but possibly someone else can comment. You might get better traction posting this on StackOverflow with the tag blpapi though, since this is more related to the underlying Bloomberg service and not pdblp which is just a wrapper around this.

fluorescent89 commented 4 years ago

@matthewgilbert Thank you so much for the response. You are right it is not directly related to pdblp, just wanted to people who are involved with this package have any experience/suggestions. I have searched the StackOverflow there and posted it as well, still No luck.

ZhihaoMa commented 2 years ago

I hava some problem. Do u solve it?