I would love to get the Alpaca .Net SDK to work in Unity Game Engine. Has anyone work on this and found a working solution?!
What type of problems do you have if you try to just use it as-is from NuGet? I’ve never tried to test it with Mono/Unity but I don’t expect any serious issues. Please, open the GitHub issue and explain all your troubles there. I’ll try to help you as much as I can.
1 Like
Thanks for offering to help @oleg.rakhmatulin
Here is the link to the open issue on Git:
opened 01:45AM - 21 Aug 21 UTC
Step 1: Access the official Alpaca SDK page to find the NuGet Package Link here:…
https://alpaca.markets/docs/api-documentation/client-sdk/
#SupportImageAttached1:

------------------------------------------------------------------------------------------------------------------------------------------
Step 2: Download the NuGet Package version (5.0.6) from here:
https://www.nuget.org/packages/Alpaca.Markets/
#SupportImageAttached2:

------------------------------------------------------------------------------------------------------------------------------------------
This next step assumes you a basic knowledge of installing and using the Unity Engine environment.
I’m using Unity version 2020.3.15f2 in this example, but any version 2019 or higher should work.
Step 3: Copy the downloaded Package and paste it into a new Unity project’s “Asset’s folder” directory.
#SupportImageAttached3:

------------------------------------------------------------------------------------------------------------------------------------------
Step 4: Notice the NuGet package name at this step: (alpaca.markets.5.0.6.nupkg) I’ll change this name in the following step in order to access the package content.
#SupportImageAttached4:

------------------------------------------------------------------------------------------------------------------------------------------
Step 5: In this step, I changed the downloaded package name by only removing the appended string (.nupkg) replacing it with (.zip ). The package file can now be unzipped, and we can now access the Highlighted content inside:
#SupportImageAttached5:

------------------------------------------------------------------------------------------------------------------------------------------
Step 6: Now inside the Unity Engines inspector, we immediately have the following errors:
Multiple precompiled assemblies with the same name Alpaca.Markets.dll included or the current platform. Only one assembly with the same name is allowed per platform. (Assets/lib/net5.0/Alpaca.Markets.dll)
In the following step, I attempt to identify the duplicate Alpaca.Markets.dll’s :
#SupportImageAttached6:

Step 7: Now after entering the unzipped content folder named “Lib” I noticed (4) additional folders named: {net5.0, net461, netstandard2.0, netstandard2.1}. Each folder containing its own Alpaca.Markets.dll and XML file.
In the following step, I attempt to randomly remove (3) of the folders containing what appear to be duplicate Alpaca.Markets.dll and XML files:
#SupportImageAttached7:

------------------------------------------------------------------------------------------------------------------------------------------
The (3) content folders I randomly selected for deletion are: {net5.0, net461, and netstandard2.1}
Step 8: Now that I’ve successfully delete (3) of the folders containing the duplicate Alpaca.Markets.dll and XML files, The Unity console presented me with the following new error:
Assembly 'Assets/lib/netstandard2.0/Alpaca.Markets.dll' will not be loaded due to errors:
Unable to resolve reference 'System.Threading.Tasks.Extensions'. Is the assembly missing or incompatible with the current platform?
Reference validation can be disabled in the Plugin Inspector.
Alpaca.Markets references strong named Newtonsoft.Json Assembly references: 13.0.0.0 Found in project: 12.0.0.0.
Assembly Version Validation can be disabled in Player Settings "Assembly Version Validation"
Unable to resolve reference 'Polly'. Is the assembly missing or incompatible with the current platform?
Reference validation can be disabled in the Plugin Inspector.
Unable to resolve reference 'WebSocket4Net'. Is the assembly missing or incompatible with the current platform?
Reference validation can be disabled in the Plugin Inspector.
Unable to resolve reference 'SuperSocket.ClientEngine'. Is the assembly missing or incompatible with the current platform?
Reference validation can be disabled in the Plugin Inspector.
#SupportImageAttached8:

------------------------------------------------------------------------------------------------------------------------------------------
Step 9: At this stage, if I attempt to create a new C# script in Unity called “AlpacaExample.cs”, as you can see in the attached image, I’m able to access the Alpaca namespaces without script compile errors being thrown.
However… in the following step…
#SupportImageAttached9:

------------------------------------------------------------------------------------------------------------------------------------------
Step 10 FinalStep: Back in the Unity inspector, however; I’m provided the following build error:
Assembly 'Assets/lib/netstandard2.0/Alpaca.Markets.dll' will not be loaded due to errors:
Unable to resolve reference 'System.Threading.Tasks.Extensions'. Is the assembly missing or incompatible with the current platform?
Reference validation can be disabled in the Plugin Inspector.
Alpaca.Markets references strong named Newtonsoft.Json Assembly references: 13.0.0.0 Found in project: 12.0.0.0.
Assembly Version Validation can be disabled in Player Settings "Assembly Version Validation"
Unable to resolve reference 'Polly'. Is the assembly missing or incompatible with the current platform?
Reference validation can be disabled in the Plugin Inspector.
Unable to resolve reference 'WebSocket4Net'. Is the assembly missing or incompatible with the current platform?
Reference validation can be disabled in the Plugin Inspector.
Unable to resolve reference 'SuperSocket.ClientEngine'. Is the assembly missing or incompatible with the current platform?
Reference validation can be disabled in the Plugin Inspector.
And this is where I’m stuck. Thanks for any help one can provide.
#SupportImageAttached10:

-END (Sorry for any typos found…)
------------------------------------------------------
[Alpaca SDK Unity Integration issues.pdf](https://github.com/alpacahq/alpaca-trade-api-csharp/files/7024663/Alpaca.SDK.Unity.Integration.issues.pdf)
This should help one completely reproduce my issues. #ThanksAgain
Support images included for every step!
kris
August 21, 2021, 4:22pm
4
one more time for anyone else facing the same issue, try to make sure you have the correct vs service pack installed