### Configuration Example
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
Example of how to configure the BLP library.
```python
config = {
"api_key": "YOUR_API_KEY",
"timeout": 30
}
blp = BLP(config=config)
```
--------------------------------
### Configuration Example
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
Example of how to configure the blp library.
```python
from blp import Blp
config = {
"api_key": "YOUR_API_KEY",
"timeout": 30
}
b = Blp(config=config)
b.run()
```
--------------------------------
### Configuration Example
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
Example of how to configure the BLP library with custom settings.
```python
config = {
"api_key": "YOUR_API_KEY",
"timeout": 30
}
blp = BLP(config=config)
```
--------------------------------
### Example Usage
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
This snippet shows a basic example of how to use the BLP project.
```python
import blp
# Initialize the BLP client
client = blp.Client()
# Get some data
data = client.get_data()
# Process the data
print(data)
```
--------------------------------
### Basic Usage Example
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
A simple example demonstrating how to import and use the BLP library.
```python
from blp import BLP
# Initialize the BLP object
blp = BLP()
# Perform some operation (example)
result = blp.process_data(data)
print(result)
```
--------------------------------
### Basic Usage Example
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
A simple example demonstrating how to initialize the BLP client and perform a basic query.
```python
from blp import Blp
blp = Blp()
# Example: Get data for a specific security
security_data = blp.get_security_data(ticker='AAPL')
print(security_data)
```
--------------------------------
### Initialize BLPQuery
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.ipynb
Starts a BLPQuery session.
```python
bquery = blp.BlpQuery().start()
```
--------------------------------
### Basic Usage Example
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
A simple example demonstrating how to use BLP to process data.
```python
from blp import BLP
blp = BLP()
result = blp.process_data(input_data)
print(result)
```
--------------------------------
### Basic Usage Example
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
A simple example demonstrating how to use the BLP library to process data.
```python
from blp import BLP
# Initialize BLP with your API key
blp = BLP("YOUR_API_KEY")
# Fetch data for a specific ticker
data = blp.get_data("AAPL")
# Print the fetched data
print(data)
```
--------------------------------
### Basic Usage Example
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
A simple example demonstrating how to use the BLP library to create a model.
```python
from blp import BLP
model = BLP()
model.train(data)
prediction = model.predict(new_data)
```
--------------------------------
### Basic Usage
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
A simple example demonstrating how to use BLP.
```python
from blp import BLP
blp = BLP()
result = blp.process("input_data")
print(result)
```
--------------------------------
### Advanced Options
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
Shows an example with more advanced configuration options.
```javascript
tippy('.my-selector', {
animation: 'scale',
delay: [200, 600],
arrow: true,
theme: 'light',
placement: 'right',
allowHTML: true,
content: '',
interactive: true,
trigger: 'click'
});
```
--------------------------------
### Basic Usage Example
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
A simple example demonstrating how to use the BLP library to create a model and train it.
```python
from blp import BLP
# Initialize the BLP model
model = BLP()
# Load your data (replace with your actual data loading)
data = {"feature1": [1, 2, 3], "target": [4, 5, 6]}
# Train the model
model.train(data)
# Make predictions
predictions = model.predict(data)
print(predictions)
```
--------------------------------
### Configuration
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
Example of configuring blp with a custom path.
```python
from blp import Blp
blobs = Blp(path="/path/to/my/blobs")
blobs.add("another_blob", "This is another blob.")
```
--------------------------------
### Start Method Example
Source: https://github.com/matthewgilbert/blp/blob/master/_autodocs/api-reference/BlpQuery.md
Example demonstrating how to start the Bloomberg session manually and use it, including error handling with a finally block, and also showing the context manager alternative.
```python
bq = BlpQuery()
bq.start()
try:
df = bq.bdp(['AAPL US Equity'], ['PX_LAST'])
finally:
bq.stop()
# Or use context manager to auto-start/stop
with BlpQuery() as bq:
df = bq.bdp(['AAPL US Equity'], ['PX_LAST'])
```
--------------------------------
### Screen for securities based on financial metrics.
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.ipynb
This example screens for global securities based on 'Core Capital Ratios' with a 'General' group option.
```python
bquery.beqs(
"Core Capital Ratios",
screen_type="GLOBAL",
options={"Group": "General"}
)
```
```text
Result:
security Tot Rsk Bsd Cap Rt LF Ticker Short Name \
0 8331 JP 11.580000 8331 JP CHIBA BANK LTD
1 ABN NA 19.799999 ABN NA ABN AMRO BANK-CV
2 ACA FP 17.900000 ACA FP CREDIT AGRICOLE
3 BAC US 15.400000 BAC US BANK OF AMERICA
4 BBVA SM 16.510000 BBVA SM BBVA
5 BNP FP 17.799999 BNP FP BNP PARIBAS
6 BNS CN 17.200001 BNS CN BANK OF NOVA SCO
7 CBK GR 19.200001 CBK GR COMMERZBANK
8 CFR US 15.280000 CFR US CULLEN/FROST
9 DANSKE DC 23.200001 DANSKE DC DANSKE BANK A/S
10 DBK GR 18.799999 DBK GR DEUTSCHE BANK-RG
11 JPM US 17.799999 JPM US JPMORGAN CHASE
12 NA CN 16.799999 NA CN NATL BK CANADA
13 NAB AU 19.879999 NAB AU NATL AUST BANK
14 PNC US 13.400000 PNC US PNC FINANCIAL SE
15 RY CN 17.600000 RY CN ROYAL BANK OF CA
16 SAN SM 16.299999 SAN SM BANCO SANTANDER
```
--------------------------------
### AJAX Setup and Request
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
Core AJAX functionality including setup, prefilters, transports, and request execution.
```javascript
var jt=/\%20/g,qt=/#.\*?/,Lt=/(\^?&)\_=\[^&\*)/,Ht=/^(.\*?):\s\[ \t\]\*(\[^\r\n\*])$/gm,Ot=/^(?:GET|HEAD)$/,Pt=/^\/\//,Rt={},Mt={},It="\*/".concat("\*"),Wt=E.createElement("a");function Ft(o){return function(e,t){"string"!=typeof e&&(t=e,e="");var n,r=0,i=e.toLowerCase().match(P)||[];if(m(t))while(n=i[r++])"+"===n[0]?(n=n.slice(1)||""):(o[n]=o[n]||[]).push(t)}return o[n]=o[n]||[]).push(t)}function Bt(t,i,o,a){var s={},u=t===Mt;function l(e){var r;return s[e]=!0,S.each(t[e]||[],function(e,t){var n=t(i,o,a);return"string"!=typeof n||u||s[n]?u?! (r=n):void 0:(i.dataTypes.unshift(n),l(n),!1)}),r}return l(i.dataTypes[0])||!s["*"]&&l("*")}function $t(e,t){var n,r,i=S.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&S.extend(!0,e,r),e}Wt.href=Tt.href,S.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Tt.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Tt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":It,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":S.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?$t($t(e,S.ajaxSettings),t):$t(S.ajaxSettings,e)},ajaxPrefilter:Ft(Rt),ajaxTransport:Ft(Mt),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var c,f,p,n,d,r,h,g,i,o,v=S.ajaxSetup({},t),y=v.context||v,m=v.context&&(y.nodeType||y.jquery)?S(y):S.event,x=S.Deferred(),b=S.Callbacks("once memory"),w=v.statusCode||{},a={},s={},u="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(h){if(!n){n={};while(t=Ht.exec(p))n[t[1].toLowerCase()+" "]=(n[t[1].toLowerCase()+" "]||[]).concat(t[2])}t=n[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return h?p:null},setRequestHeader:function(e,t){return null==h&&(e=s[e.toLowerCase()]=s[e.toLowerCase()]||e,a[e]=t),this},overrideMimeType:function(e){return null==h&&(v.mimeType=e),this},statusCode:function(e){var t;if(e)if(h)T.always(e[T.status]);else for(t in e)w[t]=[w[t],e[t]]);return this},abort:function(e){var t=e||u;return c&&c.abort(t),l(0,t),this}};if(x.promise(T),v.url=((e||v.url||Tt.href)+"").replace(Pt,Tt.protocol+"//"),v.type=t.method||t.type||v.method||v.type,v.dataTypes=(v.dataType||"*").toLowerCase().match(P)||[""]),(null==v.crossDomain){r=E.createElement("a");try{r.href=v.url,r.href=r.href,v.crossDomain=Wt.protocol+"//"+Wt.host!=r.protocol+"//"+r.host}catch(e){v.crossDomain=!0}}v.data&&v.processData&&"string"!=typeof v.data&&(v.data=S.param(v.data,v.traditional)),Bt(Rt,v,t,T),h)return T;for(i in(g=S.event&&v.global)&&0==S.active++&&S.event.trigger("ajaxStart"),v.type=v.type.toUpperCase(),v.hasContent=!Ot.test(v.type),f=v.url.replace(qt,""),v.hasContent?v.data&&v.processData&&0===(v.contentType||"").indexOf("application/x-www-form-urlencoded")&&(v.data=v.data.replace(jt,"+")):(o=v.url.slice(f.length),v.data&&(v.processData||"string"==typeof v.data)&&(f+=(Et.test(f)?"&":"?")+v.data,delete v.data),!1===v.cache&&(f=f.replace(Lt,"$1"),o=("Et.test(f)?"&":"?")+"\_="+Ct.guid+++o),v.url=f+o),v.ifModified&&("S.lastModified[f]"&&T.setRequestHeader("If-Modified-Since",S.lastModified[f]),"S.etag[f]"&&T.setRequestHeader("If-None-Match",S.etag[f]))),(v.data&&v.hasContent&&!1!==v.contentType||t.contentType)&&T.setRequestHeader("Content-Type",v.contentType),T.setRequestHeader("Accept",v.dataTypes[0]&&v.accepts[v.dataTypes[0]]?v.accepts[v.dataTypes[0]]+("*"!==v.dataTypes[0]?)," +It+" ; q=0.01":"):v.accepts["*"]),v.headers)T.setRequestHeader(i,v.headers[i]);if(v.beforeSend&&(!1===v.beforeSend.call(y,T,v)||h))return T.abort();if(u="abort",b.add(v.complete),T.done(v.success),T.fail(v.error),c=Bt(Mt,v,t,T)){if(T.readyState=1,g&&m.trigger("ajaxSend",[T,v]),v.async)0===v.timeout?T.onsend():setTimeout(function(){0===v.timeout?T.onsend():T.abort("timeout")},v.timeout);else T.onsend();else T.onsend()}else T.resolve(v.success,{},"success",T);return T}
```
--------------------------------
### Dropdowns
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
Example of a basic dropdown.
```html
```
--------------------------------
### Dropdowns with dropend
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
Example of a dropdown with dropend.
```html
```
--------------------------------
### Dropdowns with dropstart
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
Example of a dropdown with dropstart.
```html
```
--------------------------------
### Dropdowns with dropup
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
Example of a dropdown with dropup.
```html
```
--------------------------------
### Dropdowns with form
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
Example of a dropdown with a form.
```html
```
--------------------------------
### Module with Dependencies
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
Example of defining a module that depends on other modules.
```javascript
define(['dependency1', 'dependency2'], function(dep1, dep2) {
// Module code using dep1 and dep2
return {}; // Or the module's exports
});
```
--------------------------------
### Dropdowns with header
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
Example of a dropdown with a header.
```html
```
--------------------------------
### Get index constituent weights.
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.ipynb
This example retrieves the constituent tickers and their percentage weights for a given index.
```python
bquery.bds("BCOM Index", "INDX_MWEIGHT")
```
```text
Result:
Member Ticker and Exchange Code Percentage Weight
0 BOH4 2.67
1 C H4 4.31
2 CLH4 8.47
3 COH4 7.92
4 CTH4 1.55
5 GCG4 17.52
6 HGH4 5.56
7 HOH4 2.00
8 KCH4 3.74
9 KWH4 1.44
10 LAH24 4.43
11 LCG4 3.84
12 LHG4 1.60
13 LLH4 0.93
14 LNH4 1.74
15 LXH4 2.66
16 NGH24 5.62
17 QSH4 2.67
18 S H4 5.45
19 SBH4 2.95
20 SIH4 4.97
21 SMH4 3.12
22 W H4 2.55
23 XBH4 2.28
```
--------------------------------
### Get data for a commodity future.
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.ipynb
This example shows how to retrieve the name and last price for a commodity future.
```python
bquery.bdp(["CL1 Comdty"], ["NAME", "PX_LAST"])
```
```text
Result:
security NAME PX_LAST
0 CL1 Comdty Generic 1st 'CL' Future 75.27
```
--------------------------------
### Get intraday bar data for a security.
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.ipynb
This example retrieves intraday trade data for AAPL US Equity at a 60-minute interval.
```python
bquery.bdib(
"AAPL US Equity",
event_type="TRADE",
interval=60,
start_datetime="2023-11-01", # Different date format
end_datetime="2023-11-02", # Different date format
)
```
```text
Result:
time open high low close volume numEvents \
0 2023-11-01 13:30:00 171.000 171.97 170.120 171.828 8272888 41465
1 2019-01-01 14:30:00 171.835 172.08 171.000 171.430 5189464 26241
2 2019-01-01 15:30:00 171.440 172.00 171.195 171.910 2887219 14505
3 2019-01-01 16:30:00 171.905 172.38 171.630 172.162 3109733 14308
4 2019-01-01 17:30:00 172.160 172.71 171.910 172.620 4089553 20561
5 2019-01-01 18:30:00 172.620 174.22 172.100 173.910 8659156 46255
6 2019-01-01 19:30:00 173.920 174.23 173.610 173.970 13746588 32967
value
0 1.415716e+09
1 8.903882e+08
2 4.957753e+08
3 5.350173e+08
4 7.043825e+08
5 1.499576e+09
6 2.391479e+09
```
--------------------------------
### Get historical data for multiple securities and fields.
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.ipynb
This example demonstrates how to retrieve historical price and volume data for SPY and TLT equities.
```python
bquery.bdh(
["SPY US Equity", "TLT US Equity"],
["PX_LAST", "VOLUME"],
start_date="20190101",
end_date="20190110",
options={"adjustmentSplit": True}
)
```
```text
Result:
date security PX_LAST VOLUME
0 2019-01-02 SPY US Equity 250.18 126925199.0
1 2019-01-02 TLT US Equity 122.15 19841527.0
2 2019-01-03 SPY US Equity 244.21 144140692.0
3 2019-01-03 TLT US Equity 123.54 21187045.0
4 2019-01-04 SPY US Equity 252.39 142628834.0
5 2019-01-04 TLT US Equity 122.11 12970226.0
6 2019-01-07 SPY US Equity 254.38 103139100.0
7 2019-01-07 TLT US Equity 121.75 8498104.0
8 2019-01-08 SPY US Equity 256.77 102512587.0
9 2019-01-08 TLT US Equity 121.43 7737103.0
10 2019-01-09 SPY US Equity 257.97 95006554.0
11 2019-01-09 TLT US Equity 121.24 9349245.0
12 2019-01-10 SPY US Equity 258.88 96823923.0
13 2019-01-10 TLT US Equity 120.46 8222860.0
```
--------------------------------
### RequireJS Configuration Example
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
Demonstrates how to configure RequireJS, including setting the base URL, defining path mappings, and configuring shims.
```javascript
require.config({
baseUrl: "/app/src",
paths: {
"jquery": "../lib/jquery-3.5.1.min",
"underscore": "../lib/underscore-min"
},
shim: {
"underscore": {
exports: "_"
}
}
});
```
--------------------------------
### Configuration
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
Example of configuring the library, such as setting the base URL for modules.
```javascript
require.config({
baseUrl: '/static/js/lib'
});
```
--------------------------------
### Market Data Event Example
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.ipynb
An example of a market data event, including various price and change metrics for a currency pair.
```json
{
"fragmentType": 0,
"correlationIds": [
"USDCAD Curncy"
],
"messageType": "MarketDataEvents",
"timeReceived": "2023-12-27T02:21:44.104816+0000",
"element": {
"MarketDataEvents": {
"MKTDATA_EVENT_TYPE": "TRADE",
"MKTDATA_EVENT_SUBTYPE": "NEW",
"LAST_ALL_SESSIONS": 1.3198,
"LAST2_TRADE": 1.3198,
"LAST_PRICE": 1.3198,
"LAST_PRICE_TDY": 1.3198,
"LAST2_DIR": null,
"LAST_TICK_DIRECTION_RT": 0,
"ALL_PRICE_COND_CODE": null,
"ALL_PRICE": 1.3198,
"LAST_PRICE_COND_CODE_RT": null,
"PRICE_CHANGE_1Y_NET_RT": -0.032499998807907104,
"PRICE_CHANGE_1Y_PCT_RT": -2.4033000469207764,
"LAST_CONTINUOUS_TRADE_PRICE_RT": 1.3198,
"PRICE_LAST_RT": 1.3198,
"EVT_TRADE_PRICE_RT": 1.3198,
"EVT_TRADE_SIZE_RT": 0,
"EVT_TRADE_CONDITION_CODE_RT": null,
"EVT_TRADE_LOCAL_EXCH_SOURCE_RT": null,
"EVT_TRADE_SOURCE_TYPE_CODE_RT": null,
"EVT_TRADE_INTEGER_IDENTIFIER_RT": null,
"EVT_TRADE_IDENTIFIER_RT": null,
"EXCH_CODE_LAST_ALL_SESSION_RT": null,
"LOC_SRC_FOR_LST_TRD_ALL_SESS_RT": null,
"CHG_NET_REG_SESSION_CLOSE": null,
"CHG_PCT_REG_SESSION_CLOSE": null,
"CHG_NET_PREV_DAY_POST_CLS": null,
"CHG_PCT_PREV_DAY_POST_CLS": null,
"CHG_NET_1D_PRE_FROM_REGULAR_RT": null,
"CHG_PCT_1D_PRE_FROM_REGULAR_RT": null,
"CHG_NET_1D_ALL_FROM_REGULAR_RT": 0.0003,
"CHG_PCT_1D_ALL_FROM_REGULAR_RT": 0.0227,
"CHG_NET_1D_POST_FROM_REGULAR_RT": null,
"CHG_PCT_1D_POST_FROM_REGULAR_RT": null,
"PX_CHG_NET_1D_ALL_SWITCHOVER_RT": 0.0003,
"PX_CHG_PCT_1D_ALL_SWITCHOVER_RT": 0.0227,
"CHG_NET_REG_SES_PRV_RG_SES_CL_RT": 0.0003,
"CHG_PCT_REG_SES_PRV_RG_SES_CL_RT": 0.022736,
"CHG_NET_MTD_RT": -0.0363,
"CHG_PCT_MTD_RT": -2.6768,
"CHG_NET_QTD_RT": -0.0379,
"CHG_PCT_QTD_RT": -2.7915,
"CHG_NET_YTD_RT": -0.0356,
"CHG_PCT_YTD_RT": -2.6265,
"CHG_NET_1M_RT": -0.0418,
"CHG_PCT_1M_RT": -3.0699,
"CHG_NET_3M_RT": -0.03,
"CHG_PCT_3M_RT": -2.2226,
"REALTIME_2_DAY_CHANGE_NET": -0.0059,
"REALTIME_2_DAY_CHANGE_PERCENT": -0.445,
"REALTIME_5_DAY_CHANGE_NET": -0.0171,
"REALTIME_5_DAY_CHANGE_PERCENT": -1.2791,
"RT_PX_AS_PCT_INTRADAY_RANGE": 29.4118,
"REALTIME_PERCENT_BID_ASK_SPREAD": 0.0075999999999964984,
"RT_THEORETICAL_PCT_CHG_FROM_LAST": null,
"REALTIME_15_SEC_PRICE_PCT_CHG": 0.0,
"REALTIME_ONE_MIN_PRICE_PCT_CHG": 0.0152,
"REALTIME_FIVE_MIN_PRICE_PCT_CHG": 0.0303,
"REALTIME_15_MIN_PRICE_PCT_CHG": 0.0227,
"REALTIME_ONE_HOUR_PRICE_PCT_CHG": 0.0,
"REALTIME_VOLUME_5_DAY_INTERVAL": null,
"DELTA_AVAT_1_DAY_INTERVAL": null
}
}
}
```
--------------------------------
### Get the computed height of an element
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
This example shows how to get the computed height of an element. It retrieves the computed height of the first element in the matched set, including padding and border.
```javascript
var height = $( "#great" ).height();
$( "#great" ).text( "The height is " + height );
```
--------------------------------
### Get the computed width of an element
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
This example shows how to get the computed width of an element. It retrieves the computed width of the first element in the matched set, including padding and border.
```javascript
var width = $( "#great" ).width();
$( "#great" ).text( "The width is " + width );
```
--------------------------------
### Context Manager for BlpQuery
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.ipynb
Example of using the `BlpQuery` class with a context manager to fetch historical data.
```python
with blp.BlpQuery() as bq:
df = bq.bdh(
["GME US Equity"],
["PX_LAST", "VOLUME"],
start_date="20210101",
end_date="20210130",
)
df
```
--------------------------------
### Get the current scroll position of an element
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
This example shows how to get the current scroll position of an element. It retrieves the current vertical scroll position of the first element in the matched set.
```javascript
var scrollTop = $( "#great" ).scrollTop();
$( "#great" ).text( "The scroll top is " + scrollTop );
```
--------------------------------
### Animation Prefilter Example
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
This snippet demonstrates how to use prefilters to modify or extend jQuery's animation behavior before it starts.
```javascript
S.Animation=S.extend(ft,{tweeners:{"*": [function(e,t){var n=this.createTween(e,t);return se(n.elem,e,te.exec(t),n),n}]},tweener:function(e,t){m(e)?(t=e,e=["*"]):e=e.match(P);for(var n,r=0,i=e.length;r 1:
break
```
--------------------------------
### Generating a query for historical data
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.ipynb
This example demonstrates how to use `blp.create_query` to generate a historical data request in JSON format.
```python
query = blp.create_query(
request_type="HistoricalDataRequest",
values={
"securities": ["SPY US Equity"],
"fields": ["VOLUME"],
"startDate": "20190101",
"endDate": "20190105",
},
)
print(json.dumps(query, indent=2))
```
--------------------------------
### Get the computed outer height of an element
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
This example shows how to get the computed outer height of an element. It retrieves the computed outer height of the first element in the matched set, including padding, border, and margin.
```javascript
var outerHeight = $( "#great" ).outerHeight();
$( "#great" ).text( "The outer height is " + outerHeight );
```
--------------------------------
### Get the computed outer width of an element
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
This example shows how to get the computed outer width of an element. It retrieves the computed outer width of the first element in the matched set, including padding, border, and margin.
```javascript
var outerWidth = $( "#great" ).outerWidth();
$( "#great" ).text( "The outer width is " + outerWidth );
```
--------------------------------
### Advanced Configuration
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
Example of using BLP with custom configuration options.
```python
from blp import BLP
config = {
"threshold": 0.8,
"output_format": "json"
}
blp = BLP(config=config)
result = blp.process_file("path/to/another/file.csv")
print(result)
```
--------------------------------
### Using Overrides for Historical Index Weights
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.ipynb
Example of fetching historical index weights for the DAX Index with an override for the end date.
```python
bquery.bds(
"DAX Index",
"INDX_MWEIGHT_HIST",
overrides=[("END_DATE_OVERRIDE", "20230630")],
)
```
--------------------------------
### Basic Usage
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
A simple example demonstrating how to use the BLP library to fetch data.
```python
from blp import Blp
blp = Blp()
# Fetch data for a specific security
data = blp.fetch_data("AAPL US Equity", ["PX_LAST", "DS005"])
print(data)
```
--------------------------------
### Example of an invalid ticker causing an error
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.ipynb
This code snippet demonstrates how an invalid ticker in a `bdh` request leads to a `TypeError` with a security error.
```python
bquery.bdh(
["NOT_A_TICKER US Equity", "SPY US Equity"],
["PX_LAST", "VOLUME"],
start_date="20190101",
end_date="20190110",
)
```
--------------------------------
### Basic Usage
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
A simple example demonstrating how to use the BLP library to fetch data.
```python
from blp import BLP
blp = BLP("YOUR_API_KEY")
data = blp.get_data("some_endpoint")
print(data)
```
--------------------------------
### Basic BQL Query
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.ipynb
Example of a basic BQL query to retrieve the last price for IBM and AAPL equities. The result is a list of dataframes, where each dataframe corresponds to a requested field.
```python
result = bquery.bql("get(px_last) for(['IBM US Equity', 'AAPL US Equity'])")
# bquery.bql returns a list of dataframes with one dataframe per field.
result[0]
```
--------------------------------
### Basic Usage
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
A simple example demonstrating how to use BLP to process a file.
```python
from blp import BLP
blp = BLP()
result = blp.process_file("input.txt")
print(result)
```
--------------------------------
### Fetching Historical Price and Volume Data
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.ipynb
Example of using bdh to retrieve historical PX_LAST and VOLUME data for securities identified by their SEDOL 1 IDs within a specified date range.
```python
bquery.bdh(
["/sedol1/2840215", "/sedol1/2971546"],
["PX_LAST", "VOLUME"],
start_date="20190101",
end_date="20190110",
)
```
--------------------------------
### Basic Usage
Source: https://github.com/matthewgilbert/blp/blob/master/doc/source/quickstart.html
A simple example demonstrating how to use BLP to process a file.
```python
from blp import BLP
blp = BLP()
result = blp.process_file("path/to/your/file.txt")
print(result)
```