I think for higher volumes you want to split it up.
I don't think you need the id's when the other identifiers/names are enough.
- Create index / constraints per client, portfolio, trade separately
- Create clients separately.
- Create portfolios and connection to client
- pass in a collection of trades, use FOREACH to create the trades and connect them to client and portfolios
Create client
create (c:Client {name:{name}})
Create Portfolio
MATCH (c:Client {name:{name}})
FOREACH (p in {portfolios} |
MERGE (c)-[:HAS_PORT]->(:Portfolio {name:p.name})
Create Trades
FOREACH (t in {trades} |
MERGE (p:Portfolio {name: t.portfolio})
MERGE (p)-[:HAS_TRADE]->(:Trade {qty:t.quantity, prc:t.price})
)
And use parameters in cypher against the server or embedded API